diff options
author | Raymond Hettinger <python@rcn.com> | 2008-02-28 22:46:41 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-02-28 22:46:41 (GMT) |
commit | b4cbc98c3929b05501e74236e744fced9e3d4a35 (patch) | |
tree | 84ecf26531d3c4f9f1a683693a2ed826162d2b1a /Lib | |
parent | 05bf6338b810d01e7bba5503fbd01f2b6216ca59 (diff) | |
download | cpython-b4cbc98c3929b05501e74236e744fced9e3d4a35.zip cpython-b4cbc98c3929b05501e74236e744fced9e3d4a35.tar.gz cpython-b4cbc98c3929b05501e74236e744fced9e3d4a35.tar.bz2 |
Add alternate constructor for itertools.chain().
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_itertools.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index 41e9362..500afef 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -52,6 +52,13 @@ class TestBasicOps(unittest.TestCase): self.assertEqual(take(4, chain('abc', 'def')), list('abcd')) self.assertRaises(TypeError, list,chain(2, 3)) + def test_chain_from_iterable(self): + self.assertEqual(list(chain.from_iterable(['abc', 'def'])), list('abcdef')) + self.assertEqual(list(chain.from_iterable(['abc'])), list('abc')) + self.assertEqual(list(chain.from_iterable([''])), []) + self.assertEqual(take(4, chain.from_iterable(['abc', 'def'])), list('abcd')) + self.assertRaises(TypeError, list, chain.from_iterable([2, 3])) + def test_combinations(self): self.assertRaises(TypeError, combinations, 'abc') # missing r argument self.assertRaises(TypeError, combinations, 'abc', 2, 1) # too many arguments |