summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_minidom.py
diff options
context:
space:
mode:
authorKevin Kirsche <Kev.Kirsche+GitHub@gmail.com>2022-08-23 16:16:02 (GMT)
committerGitHub <noreply@github.com>2022-08-23 16:16:02 (GMT)
commit58f6953d6d3fe20d972bfa2f6e982206adcf1353 (patch)
tree9b2a12f61672ca83d915b4e9e7652d94efd748d8 /Lib/test/test_minidom.py
parent575f8880bf8498ee05a8e197fc2ed85db6880361 (diff)
downloadcpython-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.py16
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") == \