summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_copy.py
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-01-11 17:14:41 (GMT)
committerGitHub <noreply@github.com>2023-01-11 17:14:41 (GMT)
commit729ab9b622957fef0e9b494af9a71ab02986c741 (patch)
tree490f0bc8f8c6782d91142eb760d1559174c54623 /Lib/test/test_copy.py
parent762745a124cbc297cf2fe6f3ec9ca1840bb2e873 (diff)
downloadcpython-729ab9b622957fef0e9b494af9a71ab02986c741.zip
cpython-729ab9b622957fef0e9b494af9a71ab02986c741.tar.gz
cpython-729ab9b622957fef0e9b494af9a71ab02986c741.tar.bz2
gh-100871: Improve `copy` module tests (GH-100872)
CC @AlexWaygood as the reviewer of https://github.com/python/cpython/pull/100818 Automerge-Triggered-By: GH:AlexWaygood
Diffstat (limited to 'Lib/test/test_copy.py')
-rw-r--r--Lib/test/test_copy.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py
index cc95a31..826e468 100644
--- a/Lib/test/test_copy.py
+++ b/Lib/test/test_copy.py
@@ -51,6 +51,9 @@ class TestCopy(unittest.TestCase):
self.assertRaises(TypeError, copy.copy, x)
copyreg.pickle(C, pickle_C, C)
y = copy.copy(x)
+ self.assertIsNot(x, y)
+ self.assertEqual(type(y), C)
+ self.assertEqual(y.foo, x.foo)
def test_copy_reduce_ex(self):
class C(object):
@@ -311,6 +314,9 @@ class TestCopy(unittest.TestCase):
self.assertRaises(TypeError, copy.deepcopy, x)
copyreg.pickle(C, pickle_C, C)
y = copy.deepcopy(x)
+ self.assertIsNot(x, y)
+ self.assertEqual(type(y), C)
+ self.assertEqual(y.foo, x.foo)
def test_deepcopy_reduce_ex(self):
class C(object):
@@ -352,8 +358,8 @@ class TestCopy(unittest.TestCase):
pass
def f():
pass
- tests = [None, 42, 2**100, 3.14, True, False, 1j,
- "hello", "hello\u1234", f.__code__,
+ tests = [None, ..., NotImplemented, 42, 2**100, 3.14, True, False, 1j,
+ b"bytes", "hello", "hello\u1234", f.__code__,
NewStyle, range(10), max, property()]
for x in tests:
self.assertIs(copy.deepcopy(x), x)