summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-01-27 13:26:35 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-01-27 13:26:35 (GMT)
commit560f9a8a9004ba0a2ee064e9ad83f413d091b2fa (patch)
tree7447f469ab39b6d0c4bcb1e365954ce1eb300e13
parent2f6c2e03a8be51c52b5fb4fadd1214e30d09ecc3 (diff)
downloadcpython-560f9a8a9004ba0a2ee064e9ad83f413d091b2fa.zip
cpython-560f9a8a9004ba0a2ee064e9ad83f413d091b2fa.tar.gz
cpython-560f9a8a9004ba0a2ee064e9ad83f413d091b2fa.tar.bz2
Add more tests for the powerset() recipe.
-rw-r--r--Lib/test/test_itertools.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index f6a9975..1ba43f7 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -1491,6 +1491,12 @@ perform as purported.
>>> list(powerset([1,2,3]))
[(), (1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3)]
+>>> all(len(list(powerset(range(n)))) == 2**n for n in range(18))
+True
+
+>>> list(powerset('abcde')) == sorted(sorted(set(powerset('abcde'))), key=len)
+True
+
>>> list(unique_everseen('AAAABBBCCDAABBB'))
['A', 'B', 'C', 'D']