summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2008-06-10 03:34:53 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2008-06-10 03:34:53 (GMT)
commit1f2f61a78f80933a3e703df1ab08f14e70ea87d5 (patch)
tree16564a14337a5308204cb7bcffba685bb8e76b7b /Lib
parent5c4d3d0e4c6b533dbfbab36ad8034010fe90cf69 (diff)
downloadcpython-1f2f61a78f80933a3e703df1ab08f14e70ea87d5.zip
cpython-1f2f61a78f80933a3e703df1ab08f14e70ea87d5.tar.gz
cpython-1f2f61a78f80933a3e703df1ab08f14e70ea87d5.tar.bz2
Issue 2582: Fix pickling of xrange objects.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_xrange.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_xrange.py b/Lib/test/test_xrange.py
index eafb7fa..ab68c36 100644
--- a/Lib/test/test_xrange.py
+++ b/Lib/test/test_xrange.py
@@ -57,6 +57,16 @@ class XrangeTest(unittest.TestCase):
self.assertEqual(len(r), sys.maxint)
self.assertRaises(OverflowError, xrange, -sys.maxint-1, sys.maxint, 2)
+ def test_getnewargs(self):
+ def test(*args):
+ r = xrange(*args)
+ return list(r) == list(xrange(*r.__getnewargs__()))
+ tests = [(13,), (0, 11), (-22, 10), (20, 3, -1),
+ (13, 21, 3), (-2, 2, 2)]
+ for t in tests:
+ self.assert_(test(*t),
+ "xrange.__getnewargs__() failed with %r" % (t,))
+
def test_main():
test.test_support.run_unittest(XrangeTest)