summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/pickletools.py10
-rw-r--r--Lib/test/pickletester.py10
2 files changed, 15 insertions, 5 deletions
diff --git a/Lib/pickletools.py b/Lib/pickletools.py
index 6614df7..cfd5fcc 100644
--- a/Lib/pickletools.py
+++ b/Lib/pickletools.py
@@ -2128,11 +2128,11 @@ highest protocol among opcodes = 1
Exercise the INST/OBJ/BUILD family.
->>> import random
->>> dis(pickle.dumps(random.getrandbits, 0))
- 0: c GLOBAL 'random getrandbits'
- 20: p PUT 0
- 23: . STOP
+>>> import pickletools
+>>> dis(pickle.dumps(pickletools.dis, 0))
+ 0: c GLOBAL 'pickletools dis'
+ 17: p PUT 0
+ 20: . STOP
highest protocol among opcodes = 0
>>> from pickletools import _Example
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index 3ed84fb..51dd0fc 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -545,6 +545,16 @@ class AbstractPickleTests(unittest.TestCase):
got = self.loads(p)
self.assertEqual(n, got)
+ def test_float(self):
+ test_values = [0.0, 4.94e-324, 1e-310, 7e-308, 6.626e-34, 0.1, 0.5,
+ 3.14, 263.44582062374053, 6.022e23, 1e30]
+ test_values = test_values + [-x for x in test_values]
+ for proto in protocols:
+ for value in test_values:
+ pickle = self.dumps(value, proto)
+ got = self.loads(pickle)
+ self.assertEqual(value, got)
+
@run_with_locale('LC_ALL', 'de_DE', 'fr_FR')
def test_float_format(self):
# make sure that floats are formatted locale independent with proto 0