From d29f5d738cde7b1dc41640c53180bc392b81216a Mon Sep 17 00:00:00 2001 From: Daeun Lee Date: Wed, 27 Jul 2022 14:42:44 +0900 Subject: [PATCH] Update test_copy.py from CPython v3.10.5 --- Lib/test/test_copy.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py index c0988f953..5622f78d1 100644 --- a/Lib/test/test_copy.py +++ b/Lib/test/test_copy.py @@ -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):