diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-01-28 19:43:51 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-01-28 19:43:51 (GMT) |
commit | 2552c2d6f72ce0d6192277e32c4ed70ccffc501e (patch) | |
tree | 80b016e409493360905a1f5a010b372f256a166c /Lib/test/test_copy.py | |
parent | 8abaa9ab34de0ea79a60d17f73dcf8896696bfd6 (diff) | |
parent | 0a20bbf66913157bb54b8d6e426f540233c7ea6c (diff) | |
download | cpython-2552c2d6f72ce0d6192277e32c4ed70ccffc501e.zip cpython-2552c2d6f72ce0d6192277e32c4ed70ccffc501e.tar.gz cpython-2552c2d6f72ce0d6192277e32c4ed70ccffc501e.tar.bz2 |
Issue #26202: copy.deepcopy() now correctly copies range() objects with
non-atomic attributes.
Diffstat (limited to 'Lib/test/test_copy.py')
-rw-r--r-- | Lib/test/test_copy.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py index 4107e8a..7912c7c 100644 --- a/Lib/test/test_copy.py +++ b/Lib/test/test_copy.py @@ -314,7 +314,7 @@ class TestCopy(unittest.TestCase): pass tests = [None, 42, 2**100, 3.14, True, False, 1j, "hello", "hello\u1234", f.__code__, - NewStyle, range(10), Classic, max] + NewStyle, Classic, max] for x in tests: self.assertIs(copy.deepcopy(x), x) @@ -536,6 +536,17 @@ class TestCopy(unittest.TestCase): self.assertIsNot(y, x) self.assertIs(y.foo, y) + def test_deepcopy_range(self): + class I(int): + pass + x = range(I(10)) + y = copy.deepcopy(x) + self.assertIsNot(y, x) + self.assertEqual(y, x) + self.assertIsNot(y.stop, x.stop) + self.assertEqual(y.stop, x.stop) + self.assertIsInstance(y.stop, I) + # _reconstruct() def test_reconstruct_string(self): |