Update copy.py from CPython 3.11 by carlosmiei · Pull Request #4674 · RustPython/RustPython
def test_copy_reduce_ex(self): class C(object):
def test_deepcopy_reduce_ex(self): class C(object):
# Type-specific _deepcopy_xxx() methods
# TODO: RUSTPYTHON @unittest.expectedFailure def test_deepcopy_atomic(self): class Classic: pass class NewStyle(object): 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), Classic, max, property()] for x in tests: self.assertIs(copy.deepcopy(x), x)
def test_reduce_6tuple(self): def state_setter(*args, **kwargs): self.fail("shouldn't call this") class C: def __reduce__(self): return C, (), self.__dict__, None, None, state_setter x = C() with self.assertRaises(TypeError): copy.copy(x) with self.assertRaises(TypeError): copy.deepcopy(x)
def test_reduce_6tuple_none(self): class C: def __reduce__(self): return C, (), self.__dict__, None, None, None x = C() with self.assertRaises(TypeError): copy.copy(x) with self.assertRaises(TypeError): copy.deepcopy(x)
def test_copy_slots(self): class C(object): __slots__ = ["foo"]