diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2008-06-10 04:03:04 (GMT) |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2008-06-10 04:03:04 (GMT) |
commit | 7505607ae764d2095f15fcfb1a0f89843231ba7e (patch) | |
tree | c90ef9c1896e05447590b2fb1213fdf6e4aaf0d6 /Lib/test/test_range.py | |
parent | 1c9a2d96ec511e89b72db9d6c883f8266166f656 (diff) | |
download | cpython-7505607ae764d2095f15fcfb1a0f89843231ba7e.zip cpython-7505607ae764d2095f15fcfb1a0f89843231ba7e.tar.gz cpython-7505607ae764d2095f15fcfb1a0f89843231ba7e.tar.bz2 |
Issue 2582: Fix pickling of range objects.
Diffstat (limited to 'Lib/test/test_range.py')
-rw-r--r-- | Lib/test/test_range.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_range.py b/Lib/test/test_range.py index 1fd8f1d..b14a22b 100644 --- a/Lib/test/test_range.py +++ b/Lib/test/test_range.py @@ -2,6 +2,7 @@ import test.support, unittest import sys +import pickle import warnings warnings.filterwarnings("ignore", "integer argument expected", @@ -61,6 +62,15 @@ class RangeTest(unittest.TestCase): self.assertEqual(repr(range(1, 2)), 'range(1, 2)') self.assertEqual(repr(range(1, 2, 3)), 'range(1, 2, 3)') + def test_pickling(self): + testcases = [(13,), (0, 11), (-22, 10), (20, 3, -1), + (13, 21, 3), (-2, 2, 2)] + for proto in range(pickle.HIGHEST_PROTOCOL): + for t in testcases: + r = range(*t) + self.assertEquals(list(pickle.loads(pickle.dumps(r, proto))), + list(r)) + def test_main(): test.support.run_unittest(RangeTest) |