summaryrefslogtreecommitdiff
path: root/src/lxml/tests/test_etree.py
diff options
context:
space:
mode:
authorOlli Pottonen <olli.pottonen@iki.fi>2015-02-18 16:53:41 +1000
committerOlli Pottonen <olli.pottonen@iki.fi>2015-02-18 16:51:43 +1000
commitfdd2f237fb1945fde323b9e8987d7c28a769a4d0 (patch)
tree12d59cd52fff0d3e2d108807fd6e20f68e7d4df0 /src/lxml/tests/test_etree.py
parent6095a09e3f9d8e44d111c36aa813aea23885ec9a (diff)
downloadpython-lxml-fdd2f237fb1945fde323b9e8987d7c28a769a4d0.tar.gz
Make _ElementTree.deepcopy() properly handle comments/PI's before doctype.
Diffstat (limited to 'src/lxml/tests/test_etree.py')
-rw-r--r--src/lxml/tests/test_etree.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lxml/tests/test_etree.py b/src/lxml/tests/test_etree.py
index 25ad998b..8131881e 100644
--- a/src/lxml/tests/test_etree.py
+++ b/src/lxml/tests/test_etree.py
@@ -576,6 +576,17 @@ class ETreeOnlyTestCase(HelperTestCase):
self.assertEqual(_bytes("<test/>"),
tostring(root2))
+ def test_deepcopy_pi_dtd(self):
+ XML = self.etree.XML
+ tostring = self.etree.tostring
+ xml = _bytes('<!-- comment --><!DOCTYPE test [\n<!ENTITY entity "tasty">\n]>\n<test/>')
+ root = XML(xml)
+ tree1 = self.etree.ElementTree(root)
+ self.assertEqual(xml, tostring(tree1))
+
+ tree2 = copy.deepcopy(tree1)
+ self.assertEqual(xml, tostring(tree2))
+
def test_parse_remove_comments(self):
fromstring = self.etree.fromstring
tostring = self.etree.tostring