[Python-checkins] cpython: Issue #24164: Fixed test_descr: __getnewargs_ex__ now is supported in protocols

serhiy.storchaka python-checkins at python.org
Sun Oct 11 10:55:17 EDT 2015


https://hg.python.org/cpython/rev/df33dbbef7bb
changeset:   98689:df33dbbef7bb
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Oct 11 17:52:09 2015 +0300
summary:
  Issue #24164: Fixed test_descr: __getnewargs_ex__ now is supported in protocols 2 and 3.

files:
  Lib/test/test_descr.py |  9 +--------
  1 files changed, 1 insertions(+), 8 deletions(-)


diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -4738,11 +4738,8 @@
                 return (args, kwargs)
         obj = C3()
         for proto in protocols:
-            if proto >= 4:
+            if proto >= 2:
                 self._check_reduce(proto, obj, args, kwargs)
-            elif proto >= 2:
-                with self.assertRaises(ValueError):
-                    obj.__reduce_ex__(proto)
 
         class C4:
             def __getnewargs_ex__(self):
@@ -5061,10 +5058,6 @@
                 kwargs = getattr(cls, 'KWARGS', {})
                 obj = cls(*cls.ARGS, **kwargs)
                 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)
                 self._assert_is_copy(obj, objcopy)
                 # For test classes that supports this, make sure we didn't go

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list