[Python-checkins] cpython (3.2): Backport minidom attribute tests from default (73c76466cf44).

eric.araujo python-checkins at python.org
Mon Mar 5 16:26:18 CET 2012


http://hg.python.org/cpython/rev/0860e8a24858
changeset:   75427:0860e8a24858
branch:      3.2
user:        Éric Araujo <merwok at netwok.org>
date:        Mon Mar 05 16:11:41 2012 +0100
summary:
  Backport minidom attribute tests from default (73c76466cf44).

Some minidom code changed between 3.2 and 3.3, so to be sure to avoid
differenced in behavior I’m backporting these tests added by MvL.

files:
  Lib/test/test_minidom.py |  26 ++++++++++++++++++++++----
  1 files changed, 22 insertions(+), 4 deletions(-)


diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -350,13 +350,31 @@
     def testGetAttrList(self):
         pass
 
-    def testGetAttrValues(self): pass
+    def testGetAttrValues(self):
+        pass
 
-    def testGetAttrLength(self): pass
+    def testGetAttrLength(self):
+        pass
 
-    def testGetAttribute(self): pass
+    def testGetAttribute(self):
+        dom = Document()
+        child = dom.appendChild(
+            dom.createElementNS("http://www.python.org", "python:abc"))
+        self.assertEqual(child.getAttribute('missing'), '')
 
-    def testGetAttributeNS(self): pass
+    def testGetAttributeNS(self):
+        dom = Document()
+        child = dom.appendChild(
+                dom.createElementNS("http://www.python.org", "python:abc"))
+        child.setAttributeNS("http://www.w3.org", "xmlns:python",
+                                                "http://www.python.org")
+        self.assertEqual(child.getAttributeNS("http://www.w3.org", "python"),
+            'http://www.python.org')
+        self.assertEqual(child.getAttributeNS("http://www.w3.org", "other"),
+            '')
+        child2 = child.appendChild(dom.createElement('abc'))
+        self.assertEqual(child2.getAttributeNS("http://www.python.org", "missing"),
+                         '')
 
     def testGetAttributeNode(self): pass
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list