summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_xml_etree.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-11-12 09:23:04 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-11-12 09:23:04 (GMT)
commitd7a441559921804a5a6141c3ec42f896f8f3b010 (patch)
treeeaeaa693fe1af5871f54222f7d07d7cc49d3dd16 /Lib/test/test_xml_etree.py
parenta9dcdabccb1a1f7c76030c0b188ecaf7ab599e57 (diff)
downloadcpython-d7a441559921804a5a6141c3ec42f896f8f3b010.zip
cpython-d7a441559921804a5a6141c3ec42f896f8f3b010.tar.gz
cpython-d7a441559921804a5a6141c3ec42f896f8f3b010.tar.bz2
Issue #22995: Default implementation of __reduce__ and __reduce_ex__ now
rejects builtin types with not defined __new__. Added tests for non-pickleable types.
Diffstat (limited to 'Lib/test/test_xml_etree.py')
-rw-r--r--Lib/test/test_xml_etree.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index b87b098..d879245 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -5,6 +5,7 @@
# For this purpose, the module-level "ET" symbol is temporarily
# monkey-patched when running the "test_xml_etree_c" test suite.
+import copy
import html
import io
import operator
@@ -2082,6 +2083,19 @@ class ElementIterTest(unittest.TestCase):
self.assertEqual(self._ilist(doc), all_tags)
self.assertEqual(self._ilist(doc, '*'), all_tags)
+ def test_copy(self):
+ a = ET.Element('a')
+ it = a.iter()
+ with self.assertRaises(TypeError):
+ copy.copy(it)
+
+ def test_pickle(self):
+ a = ET.Element('a')
+ it = a.iter()
+ for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+ with self.assertRaises((TypeError, pickle.PicklingError)):
+ pickle.dumps(it, proto)
+
class TreeBuilderTest(unittest.TestCase):
sample1 = ('<!DOCTYPE html PUBLIC'