diff options
author | Raymond Hettinger <python@rcn.com> | 2004-02-10 09:25:40 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-02-10 09:25:40 (GMT) |
commit | 5cab2e3a88903b0cea558ee01b8f5b9e5a31a797 (patch) | |
tree | 520d1fdfefd2c4104669ad18fc30e0e86dbadc2c /Lib/test/test_itertools.py | |
parent | 27da291b2c2b32b0f976bb7599f6e9b2d07e6e4c (diff) | |
download | cpython-5cab2e3a88903b0cea558ee01b8f5b9e5a31a797.zip cpython-5cab2e3a88903b0cea558ee01b8f5b9e5a31a797.tar.gz cpython-5cab2e3a88903b0cea558ee01b8f5b9e5a31a797.tar.bz2 |
Give itertools.repeat() a length method.
Diffstat (limited to 'Lib/test/test_itertools.py')
-rw-r--r-- | Lib/test/test_itertools.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index fe49f75..73e8809 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -607,6 +607,12 @@ class TestVariousIteratorArgs(unittest.TestCase): self.assertRaises(TypeError, list, tee(N(s))[0]) self.assertRaises(ZeroDivisionError, list, tee(E(s))[0]) +class LengthTransparency(unittest.TestCase): + + def test_repeat(self): + self.assertEqual(len(repeat(None, 50)), 50) + self.assertRaises(TypeError, len, repeat(None)) + class RegressionTests(unittest.TestCase): def test_sf_793826(self): @@ -826,7 +832,7 @@ __test__ = {'libreftest' : libreftest} def test_main(verbose=None): test_classes = (TestBasicOps, TestVariousIteratorArgs, TestGC, - RegressionTests) + RegressionTests, LengthTransparency) test_support.run_unittest(*test_classes) # verify reference counting |