Skip to content

Commit 6690419

Browse files
hugovkencukou
authored andcommitted
Add test
1 parent 0970bc3 commit 6690419

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Lib/test/test_minidom.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import xml.dom.minidom
1111

12-
from xml.dom.minidom import parse, Attr, Node, Document, parseString
12+
from xml.dom.minidom import parse, Attr, Node, Document, Element, parseString
1313
from xml.dom.minidom import getDOMImplementation
1414
from xml.parsers.expat import ExpatError
1515

@@ -191,6 +191,14 @@ def testAppendChildNoQuadraticComplexity(self):
191191
# This example used to take at least 30 seconds.
192192
self.assertLess(end - start, 1)
193193

194+
def testSetAttributeNodeWithoutOwnerDocument(self):
195+
# regression test for gh-142754
196+
elem = Element("test")
197+
attr = Attr("id")
198+
attr.value = "test-id"
199+
elem.setAttributeNode(attr)
200+
self.assertEqual(elem.getAttribute("id"), "test-id")
201+
194202
def testAppendChildFragment(self):
195203
dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes()
196204
dom.documentElement.appendChild(frag)

0 commit comments

Comments
 (0)