Skip to content

Commit d29f5d7

Browse files
committed
Update test_copy.py from CPython v3.10.5
1 parent dfc9b6a commit d29f5d7

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

Lib/test/test_copy.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from operator import le, lt, ge, gt, eq, ne
88

99
import unittest
10+
from test import support
1011

1112
order_comparisons = le, lt, ge, gt
1213
equality_comparisons = eq, ne
@@ -99,7 +100,7 @@ class WithMetaclass(metaclass=abc.ABCMeta):
99100
42, 2**100, 3.14, True, False, 1j,
100101
"hello", "hello\u1234", f.__code__,
101102
b"world", bytes(range(256)), range(10), slice(1, 10, 2),
102-
NewStyle, Classic, max, WithMetaclass]
103+
NewStyle, Classic, max, WithMetaclass, property()]
103104
for x in tests:
104105
self.assertIs(copy.copy(x), x)
105106

@@ -350,6 +351,8 @@ def __getattribute__(self, name):
350351

351352
# Type-specific _deepcopy_xxx() methods
352353

354+
# TODO: RUSTPYTHON
355+
@unittest.expectedFailure
353356
def test_deepcopy_atomic(self):
354357
class Classic:
355358
pass
@@ -359,7 +362,7 @@ def f():
359362
pass
360363
tests = [None, 42, 2**100, 3.14, True, False, 1j,
361364
"hello", "hello\u1234", f.__code__,
362-
NewStyle, Classic, max]
365+
NewStyle, range(10), Classic, max, property()]
363366
for x in tests:
364367
self.assertIs(copy.deepcopy(x), x)
365368

@@ -583,17 +586,6 @@ class C:
583586
self.assertIsNot(y, x)
584587
self.assertIs(y.foo, y)
585588

586-
def test_deepcopy_range(self):
587-
class I(int):
588-
pass
589-
x = range(I(10))
590-
y = copy.deepcopy(x)
591-
self.assertIsNot(y, x)
592-
self.assertEqual(y, x)
593-
self.assertIsNot(y.stop, x.stop)
594-
self.assertEqual(y.stop, x.stop)
595-
self.assertIsInstance(y.stop, I)
596-
597589
# _reconstruct()
598590

599591
def test_reconstruct_string(self):
@@ -820,6 +812,7 @@ class C(object):
820812
self.assertEqual(v[c], d)
821813
self.assertEqual(len(v), 2)
822814
del c, d
815+
support.gc_collect() # For PyPy or other GCs.
823816
self.assertEqual(len(v), 1)
824817
x, y = C(), C()
825818
# The underlying containers are decoupled
@@ -849,6 +842,7 @@ def __init__(self, i):
849842
self.assertEqual(v[a].i, b.i)
850843
self.assertEqual(v[c].i, d.i)
851844
del c
845+
support.gc_collect() # For PyPy or other GCs.
852846
self.assertEqual(len(v), 1)
853847

854848
def test_deepcopy_weakvaluedict(self):
@@ -872,6 +866,7 @@ def __init__(self, i):
872866
self.assertIs(t, d)
873867
del x, y, z, t
874868
del d
869+
support.gc_collect() # For PyPy or other GCs.
875870
self.assertEqual(len(v), 1)
876871

877872
def test_deepcopy_bound_method(self):

0 commit comments

Comments
 (0)