summaryrefslogtreecommitdiff
path: root/Lib/test/test_itertools.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-11-01 18:43:31 +0000
committerRaymond Hettinger <python@rcn.com>2009-11-01 18:43:31 +0000
commit4da5faae212b31bf24efcc72e03a1484166a2917 (patch)
treedcce524b48a99792476e57dfd9376457a076b7f4 /Lib/test/test_itertools.py
parent6da85f947f0c03a9fde7de4a9386498be8eaaa94 (diff)
downloadcpython-git-4da5faae212b31bf24efcc72e03a1484166a2917.tar.gz
Issue 7244: Fix indentation in C code. Fix test to not sent output to stdout.
Diffstat (limited to 'Lib/test/test_itertools.py')
-rw-r--r--Lib/test/test_itertools.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index ee5af4b601..dbc941fd77 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -422,7 +422,8 @@ class TestBasicOps(unittest.TestCase):
def run(r1, r2):
result = []
for i, j in izip_longest(r1, r2, fillvalue=0):
- print(i, j)
+ with test_support.captured_output('stdout'):
+ print (i, j)
result.append((i, j))
return result
self.assertEqual(run(r1, r2), [(1,2), (1,2), (1,2), (0,2)])
@@ -431,8 +432,11 @@ class TestBasicOps(unittest.TestCase):
# and StopIteration would stop as expected
r1 = Repeater(1, 3, RuntimeError)
r2 = Repeater(2, 4, StopIteration)
- mylist = lambda it: [v for v in it]
- self.assertRaises(RuntimeError, mylist, izip_longest(r1, r2, fillvalue=0))
+ it = izip_longest(r1, r2, fillvalue=0)
+ self.assertEqual(next(it), (1, 2))
+ self.assertEqual(next(it), (1, 2))
+ self.assertEqual(next(it), (1, 2))
+ self.assertRaises(RuntimeError, next, it)
def test_product(self):
for args, result in [
@@ -723,7 +727,6 @@ class TestBasicOps(unittest.TestCase):
self.assertRaises(StopIteration, f(lambda x:x, []).next)
self.assertRaises(StopIteration, f(lambda x:x, StopNow()).next)
-
class TestExamples(unittest.TestCase):
def test_chain(self):