Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(18)

Unified Diff: Lib/test/test_itertools.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_io.py ('k') | Lib/test/test_kqueue.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_itertools.py Tue Jul 26 09:37:46 2011 +0300
+++ b/Lib/test/test_itertools.py Mon Jul 25 09:47:18 2011 -0400
@@ -168,8 +168,7 @@
self.assertEqual(result, list(combinations2(values, r))) # matches second pure python version
self.assertEqual(result, list(combinations3(values, r))) # matches second pure python version
- @support.impl_detail("tuple reuse is specific to CPython")
- def test_combinations_tuple_reuse(self):
+ # Test implementation detail: tuple re-use
self.assertEqual(len(set(map(id, combinations('abcde', 3)))), 1)
self.assertNotEqual(len(set(map(id, list(combinations('abcde', 3))))), 1)
@@ -239,9 +238,7 @@
self.assertEqual(result, list(cwr1(values, r))) # matches first pure python version
self.assertEqual(result, list(cwr2(values, r))) # matches second pure python version
- @support.impl_detail("tuple reuse is specific to CPython")
- def test_combinations_with_replacement_tuple_reuse(self):
- cwr = combinations_with_replacement
+ # Test implementation detail: tuple re-use
self.assertEqual(len(set(map(id, cwr('abcde', 3)))), 1)
self.assertNotEqual(len(set(map(id, list(cwr('abcde', 3))))), 1)
@@ -305,8 +302,7 @@
self.assertEqual(result, list(permutations(values, None))) # test r as None
self.assertEqual(result, list(permutations(values))) # test default r
- @support.impl_detail("tuple resuse is CPython specific")
- def test_permutations_tuple_reuse(self):
+ # Test implementation detail: tuple re-use
self.assertEqual(len(set(map(id, permutations('abcde', 3)))), 1)
self.assertNotEqual(len(set(map(id, list(permutations('abcde', 3))))), 1)
@@ -570,13 +566,11 @@
self.assertEqual(list(zip()), lzip())
self.assertRaises(TypeError, zip, 3)
self.assertRaises(TypeError, zip, range(3), 3)
+ # Check tuple re-use (implementation detail)
self.assertEqual([tuple(list(pair)) for pair in zip('abc', 'def')],
lzip('abc', 'def'))
self.assertEqual([pair for pair in zip('abc', 'def')],
lzip('abc', 'def'))
-
- @support.impl_detail("tuple reuse is specific to CPython")
- def test_zip_tuple_reuse(self):
ids = list(map(id, zip('abc', 'def')))
self.assertEqual(min(ids), max(ids))
ids = list(map(id, list(zip('abc', 'def'))))
@@ -619,13 +613,11 @@
else:
self.fail('Did not raise Type in: ' + stmt)
+ # Check tuple re-use (implementation detail)
self.assertEqual([tuple(list(pair)) for pair in zip_longest('abc', 'def')],
list(zip('abc', 'def')))
self.assertEqual([pair for pair in zip_longest('abc', 'def')],
list(zip('abc', 'def')))
-
- @support.impl_detail("tuple reuse is specific to CPython")
- def test_zip_longest_tuple_reuse(self):
ids = list(map(id, zip_longest('abc', 'def')))
self.assertEqual(min(ids), max(ids))
ids = list(map(id, list(zip_longest('abc', 'def'))))
@@ -729,8 +721,7 @@
args = map(iter, args)
self.assertEqual(len(list(product(*args))), expected_len)
- @support.impl_detail("tuple reuse is specific to CPython")
- def test_product_tuple_reuse(self):
+ # Test implementation detail: tuple re-use
self.assertEqual(len(set(map(id, product('abc', 'def')))), 1)
self.assertNotEqual(len(set(map(id, list(product('abc', 'def'))))), 1)
« no previous file with comments | « Lib/test/test_io.py ('k') | Lib/test/test_kqueue.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+