mirror of
https://github.com/python/cpython.git
synced 2025-08-01 23:53:15 +00:00
Issue #24164: Fixed test_descr: __getnewargs_ex__ now is supported in protocols 2 and 3.
This commit is contained in:
parent
99deb1989f
commit
20d15b5100
1 changed files with 1 additions and 8 deletions
|
@ -4738,11 +4738,8 @@ class PicklingTests(unittest.TestCase):
|
||||||
return (args, kwargs)
|
return (args, kwargs)
|
||||||
obj = C3()
|
obj = C3()
|
||||||
for proto in protocols:
|
for proto in protocols:
|
||||||
if proto >= 4:
|
if proto >= 2:
|
||||||
self._check_reduce(proto, obj, args, kwargs)
|
self._check_reduce(proto, obj, args, kwargs)
|
||||||
elif proto >= 2:
|
|
||||||
with self.assertRaises(ValueError):
|
|
||||||
obj.__reduce_ex__(proto)
|
|
||||||
|
|
||||||
class C4:
|
class C4:
|
||||||
def __getnewargs_ex__(self):
|
def __getnewargs_ex__(self):
|
||||||
|
@ -5061,10 +5058,6 @@ class PicklingTests(unittest.TestCase):
|
||||||
kwargs = getattr(cls, 'KWARGS', {})
|
kwargs = getattr(cls, 'KWARGS', {})
|
||||||
obj = cls(*cls.ARGS, **kwargs)
|
obj = cls(*cls.ARGS, **kwargs)
|
||||||
proto = pickle_copier.proto
|
proto = pickle_copier.proto
|
||||||
if 2 <= proto < 4 and hasattr(cls, '__getnewargs_ex__'):
|
|
||||||
with self.assertRaises(ValueError):
|
|
||||||
pickle_copier.dumps(obj, proto)
|
|
||||||
continue
|
|
||||||
objcopy = pickle_copier.copy(obj)
|
objcopy = pickle_copier.copy(obj)
|
||||||
self._assert_is_copy(obj, objcopy)
|
self._assert_is_copy(obj, objcopy)
|
||||||
# For test classes that supports this, make sure we didn't go
|
# For test classes that supports this, make sure we didn't go
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue