diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2012-03-05 06:01:49 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2012-03-05 06:01:49 (GMT) |
commit | 67245a6ed4a5e36584e5b6d9f0dd5ee4e42d65b1 (patch) | |
tree | d97df086ba7d0659893935d3213f118b4714f2aa /Lib/test/test_minidom.py | |
parent | f1c42599bae9fcc47eb5f5d38ff077c000fef38f (diff) | |
download | cpython-67245a6ed4a5e36584e5b6d9f0dd5ee4e42d65b1.zip cpython-67245a6ed4a5e36584e5b6d9f0dd5ee4e42d65b1.tar.gz cpython-67245a6ed4a5e36584e5b6d9f0dd5ee4e42d65b1.tar.bz2 |
Issue #14168: Check for presence of _attrs before accessing it.
Diffstat (limited to 'Lib/test/test_minidom.py')
-rw-r--r-- | Lib/test/test_minidom.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py index 752a840..cc4c95b 100644 --- a/Lib/test/test_minidom.py +++ b/Lib/test/test_minidom.py @@ -362,11 +362,17 @@ class MinidomTest(unittest.TestCase): 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): dom = Document() @@ -378,6 +384,9 @@ class MinidomTest(unittest.TestCase): '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 |