diff options
author | Kevin Kirsche <Kev.Kirsche+GitHub@gmail.com> | 2022-08-23 16:16:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-23 16:16:02 (GMT) |
commit | 58f6953d6d3fe20d972bfa2f6e982206adcf1353 (patch) | |
tree | 9b2a12f61672ca83d915b4e9e7652d94efd748d8 /Lib/test/test_minidom.py | |
parent | 575f8880bf8498ee05a8e197fc2ed85db6880361 (diff) | |
download | cpython-58f6953d6d3fe20d972bfa2f6e982206adcf1353.zip cpython-58f6953d6d3fe20d972bfa2f6e982206adcf1353.tar.gz cpython-58f6953d6d3fe20d972bfa2f6e982206adcf1353.tar.bz2 |
gh-96175: add missing self._localName assignment in `xml.dom.minidom.Attr` (#96176)
X-Ref: https://github.com/python/typeshed/pull/8590#discussion_r951473977
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Lib/test/test_minidom.py')
-rw-r--r-- | Lib/test/test_minidom.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py index 9762025..ef38c36 100644 --- a/Lib/test/test_minidom.py +++ b/Lib/test/test_minidom.py @@ -9,7 +9,7 @@ import unittest import pyexpat import xml.dom.minidom -from xml.dom.minidom import parse, Node, Document, parseString +from xml.dom.minidom import parse, Attr, Node, Document, parseString from xml.dom.minidom import getDOMImplementation from xml.parsers.expat import ExpatError @@ -77,6 +77,20 @@ class MinidomTest(unittest.TestCase): dom.unlink() self.confirm(isinstance(dom, Document)) + def testAttrModeSetsParamsAsAttrs(self): + attr = Attr("qName", "namespaceURI", "localName", "prefix") + self.assertEqual(attr.name, "qName") + self.assertEqual(attr.namespaceURI, "namespaceURI") + self.assertEqual(attr.prefix, "prefix") + self.assertEqual(attr.localName, "localName") + + def testAttrModeSetsNonOptionalAttrs(self): + attr = Attr("qName", "namespaceURI", None, "prefix") + self.assertEqual(attr.name, "qName") + self.assertEqual(attr.namespaceURI, "namespaceURI") + self.assertEqual(attr.prefix, "prefix") + self.assertEqual(attr.localName, attr.name) + def testGetElementsByTagName(self): dom = parse(tstfile) self.confirm(dom.getElementsByTagName("LI") == \ |