MCPcopy Index your code
hub / github.com/RustPython/RustPython / testCloneDocumentDeep

Method testCloneDocumentDeep

Lib/test/test_minidom.py:822–845  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

820 " shallow cloning of documents makes no sense!")
821
822 def testCloneDocumentDeep(self):
823 doc = parseString("<?xml version='1.0'?>\n"
824 "<!-- comment -->"
825 "<!DOCTYPE doc [\n"
826 "<!NOTATION notation SYSTEM 'http://xml.python.org/'>\n"
827 "]>\n"
828 "<doc attr='value'/>")
829 doc2 = doc.cloneNode(1)
830 self.assertFalse((doc.isSameNode(doc2) or doc2.isSameNode(doc)),
831 "testCloneDocumentDeep: document objects not distinct")
832 self.assertEqual(len(doc.childNodes), len(doc2.childNodes),
833 "testCloneDocumentDeep: wrong number of Document children")
834 self.assertEqual(doc2.documentElement.nodeType, Node.ELEMENT_NODE,
835 "testCloneDocumentDeep: documentElement not an ELEMENT_NODE")
836 self.assertTrue(doc2.documentElement.ownerDocument.isSameNode(doc2),
837 "testCloneDocumentDeep: documentElement owner is not new document")
838 self.assertFalse(doc.documentElement.isSameNode(doc2.documentElement),
839 "testCloneDocumentDeep: documentElement should not be shared")
840 if doc.doctype is not None:
841 # check the doctype iff the original DOM maintained it
842 self.assertEqual(doc2.doctype.nodeType, Node.DOCUMENT_TYPE_NODE,
843 "testCloneDocumentDeep: doctype not a DOCUMENT_TYPE_NODE")
844 self.assertTrue(doc2.doctype.ownerDocument.isSameNode(doc2))
845 self.assertFalse(doc.doctype.isSameNode(doc2.doctype))
846
847 def testCloneDocumentTypeDeepOk(self):
848 doctype = create_nonempty_doctype()

Callers

nothing calls this directly

Calls 7

parseStringFunction · 0.90
lenFunction · 0.85
assertFalseMethod · 0.80
isSameNodeMethod · 0.80
assertTrueMethod · 0.80
cloneNodeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected