summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fractions.py
diff options
context:
space:
mode:
authorSergey B Kirpichev <2155800+skirpichev@users.noreply.github.com>2021-05-17 07:20:02 (GMT)
committerGitHub <noreply@github.com>2021-05-17 07:20:02 (GMT)
commitb102dd598dd2666b72e93ae53ae813d1e88f186c (patch)
tree06d92560ced1302efbd45e4317fc90282aa8905f /Lib/test/test_fractions.py
parentb3f65e819f552561294a66e350a9f5a3131f7df2 (diff)
downloadcpython-b102dd598dd2666b72e93ae53ae813d1e88f186c.zip
cpython-b102dd598dd2666b72e93ae53ae813d1e88f186c.tar.gz
cpython-b102dd598dd2666b72e93ae53ae813d1e88f186c.tar.bz2
bpo-44154: optimize Fraction pickling (GH-26186)
Diffstat (limited to 'Lib/test/test_fractions.py')
-rw-r--r--Lib/test/test_fractions.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_fractions.py b/Lib/test/test_fractions.py
index b925525..949ddd9 100644
--- a/Lib/test/test_fractions.py
+++ b/Lib/test/test_fractions.py
@@ -10,6 +10,7 @@ import functools
import sys
import unittest
from copy import copy, deepcopy
+import pickle
from pickle import dumps, loads
F = fractions.Fraction
@@ -691,7 +692,8 @@ class FractionTest(unittest.TestCase):
def test_copy_deepcopy_pickle(self):
r = F(13, 7)
dr = DummyFraction(13, 7)
- self.assertEqual(r, loads(dumps(r)))
+ for proto in range(0, pickle.HIGHEST_PROTOCOL + 1):
+ self.assertEqual(r, loads(dumps(r, proto)))
self.assertEqual(id(r), id(copy(r)))
self.assertEqual(id(r), id(deepcopy(r)))
self.assertNotEqual(id(dr), id(copy(dr)))