Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
After working on #100817 I've noticed that there are multiple things that can be improved in terms of copy module tests:
- First of all, I had submitted some broken code in gh-100817: Speed up
copy.deepcopycalls onsliceobjects #100818 but, our test cases were not able to detect it. Solution: add a new test case intest_slice.pywithcopyanddeepcopycalls. I think it should be intest_sliceand not intest_copy, because there's nothing special about it:copydoes not change its behaviour or special case it. - This test ensures that after modifing
copyregwe can now copy an object, but does not assert the result:Right now it can be whatever. The same happens inLines 42 to 55 in e47b139
deftest_copy_registry(self): classC(object): def__new__(cls, foo): obj=object.__new__(cls) obj.foo=foo returnobj defpickle_C(obj): return (C, (obj.foo,)) x=C(42) self.assertRaises(TypeError, copy.copy, x) copyreg.pickle(C, pickle_C, C) y=copy.copy(x) deftest_copy_reduce_ex(self): Solution: add required assertionsLines 302 to 315 in e47b139
deftest_deepcopy_registry(self): classC(object): def__new__(cls, foo): obj=object.__new__(cls) obj.foo=foo returnobj defpickle_C(obj): return (C, (obj.foo,)) x=C(42) self.assertRaises(TypeError, copy.deepcopy, x) copyreg.pickle(C, pickle_C, C) y=copy.deepcopy(x) deftest_deepcopy_reduce_ex(self): test_deepcopy_atomicmisses several important types:bytes,types.EllipsisType,NotImplementedType.Lines 350 to 359 in e47b139
deftest_deepcopy_atomic(self): classNewStyle: pass deff(): pass tests= [None, 42, 2**100, 3.14, True, False, 1j, "hello", "hello\u1234", f.__code__, NewStyle, range(10), max, property()] forxintests: self.assertIs(copy.deepcopy(x), x)
PR is incoming.
Linked PRs
Metadata
Metadata
Assignees
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error