cpython: f78b9f700d45 (original) (raw)
--- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -66,18 +66,14 @@ try: except Exception: pass -def test_pickle_dump_load(assertion, source, target=None,
+def test_pickle_dump_load(assertion, source, target=None): if target is None: target = source
- for protocol in range(HIGHEST_PROTOCOL + 1): assertion(loads(dumps(source, protocol=protocol)), target)
-def test_pickle_exception(assertion, exception, obj,
*, protocol=(0, HIGHEST_PROTOCOL)):[](#l1.18)
- start, stop = protocol
- for protocol in range(start, stop+1):
+def test_pickle_exception(assertion, exception, obj):
- for protocol in range(HIGHEST_PROTOCOL + 1): with assertion(exception): dumps(obj, protocol=protocol)
@@ -575,11 +571,7 @@ class TestEnum(unittest.TestCase): self.class.NestedEnum = NestedEnum self.NestedEnum.qualname = '%s.NestedEnum' % self.class.name
test_pickle_exception([](#l1.30)
self.assertRaises, PicklingError, self.NestedEnum.twigs,[](#l1.31)
protocol=(0, 3))[](#l1.32)
test_pickle_dump_load(self.assertIs, self.NestedEnum.twigs,[](#l1.33)
protocol=(4, HIGHEST_PROTOCOL))[](#l1.34)
test_pickle_dump_load(self.assertIs, self.NestedEnum.twigs)[](#l1.35)
def test_pickle_by_name(self): class ReplaceGlobalInt(IntEnum): @@ -1096,9 +1088,9 @@ class TestEnum(unittest.TestCase): globals()['NEI'] = NEI NI5 = NamedInt('test', 5) self.assertEqual(NI5, 5)
test_pickle_dump_load(self.assertEqual, NI5, 5, protocol=(4, 4))[](#l1.43)
test_pickle_dump_load(self.assertEqual, NI5, 5)[](#l1.44) self.assertEqual(NEI.y.value, 2)[](#l1.45)
test_pickle_dump_load(self.assertIs, NEI.y, protocol=(4, 4))[](#l1.46)
test_pickle_dump_load(self.assertIs, NEI.y)[](#l1.47) test_pickle_dump_load(self.assertIs, NEI)[](#l1.48)