Update test_copy.py from CPython v3.10.5

This commit is contained in:
Daeun Lee committed 2022-07-27 14:42:44 +09:00
1 parent dfc9b6abf4
commit d29f5d738c
1 file changed
+8 -13
+8 -13
View File
@@ -7,6 +7,7 @@ import abc
from operator import le, lt, ge, gt, eq, ne
import unittest
from test import support
order_comparisons = le, lt, ge, gt
equality_comparisons = eq, ne
@@ -99,7 +100,7 @@ class TestCopy(unittest.TestCase):
42, 2**100, 3.14, True, False, 1j,
"hello", "hello\u1234", f.__code__,
b"world", bytes(range(256)), range(10), slice(1, 10, 2),
NewStyle, Classic, max, WithMetaclass]
NewStyle, Classic, max, WithMetaclass, property()]
for x in tests:
self.assertIs(copy.copy(x), x)
@@ -350,6 +351,8 @@ class TestCopy(unittest.TestCase):
# Type-specific _deepcopy_xxx() methods
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_deepcopy_atomic(self):
class Classic:
pass
@@ -359,7 +362,7 @@ class TestCopy(unittest.TestCase):
pass
tests = [None, 42, 2**100, 3.14, True, False, 1j,
"hello", "hello\u1234", f.__code__,
NewStyle, Classic, max]
NewStyle, range(10), Classic, max, property()]
for x in tests:
self.assertIs(copy.deepcopy(x), x)
@@ -583,17 +586,6 @@ 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):
@@ -820,6 +812,7 @@ class TestCopy(unittest.TestCase):
self.assertEqual(v[c], d)
self.assertEqual(len(v), 2)
del c, d
support.gc_collect() # For PyPy or other GCs.
self.assertEqual(len(v), 1)
x, y = C(), C()
# The underlying containers are decoupled
@@ -849,6 +842,7 @@ class TestCopy(unittest.TestCase):
self.assertEqual(v[a].i, b.i)
self.assertEqual(v[c].i, d.i)
del c
support.gc_collect() # For PyPy or other GCs.
self.assertEqual(len(v), 1)
def test_deepcopy_weakvaluedict(self):
@@ -872,6 +866,7 @@ class TestCopy(unittest.TestCase):
self.assertIs(t, d)
del x, y, z, t
del d
support.gc_collect() # For PyPy or other GCs.
self.assertEqual(len(v), 1)
def test_deepcopy_bound_method(self):