Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 420f698

Browse files
committed
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.
1 parent e413c06 commit 420f698

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

Lib/test/test_minidom.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,31 @@ def testChangeAttr(self):
350350
def testGetAttrList(self):
351351
pass
352352

353-
def testGetAttrValues(self): pass
353+
def testGetAttrValues(self):
354+
pass
354355

355-
def testGetAttrLength(self): pass
356+
def testGetAttrLength(self):
357+
pass
356358

357-
def testGetAttribute(self): pass
359+
def testGetAttribute(self):
360+
dom = Document()
361+
child = dom.appendChild(
362+
dom.createElementNS("http://www.python.org", "python:abc"))
363+
self.assertEqual(child.getAttribute('missing'), '')
358364

359-
def testGetAttributeNS(self): pass
365+
def testGetAttributeNS(self):
366+
dom = Document()
367+
child = dom.appendChild(
368+
dom.createElementNS("http://www.python.org", "python:abc"))
369+
child.setAttributeNS("http://www.w3.org", "xmlns:python",
370+
"http://www.python.org")
371+
self.assertEqual(child.getAttributeNS("http://www.w3.org", "python"),
372+
'http://www.python.org')
373+
self.assertEqual(child.getAttributeNS("http://www.w3.org", "other"),
374+
'')
375+
child2 = child.appendChild(dom.createElement('abc'))
376+
self.assertEqual(child2.getAttributeNS("http://www.python.org", "missing"),
377+
'')
360378

361379
def testGetAttributeNode(self): pass
362380

0 commit comments

Comments
 (0)