summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-01-27 13:29:43 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-01-27 13:29:43 (GMT)
commit191e850053128f726d6562e1d8306dfe5e4aa8aa (patch)
tree27aa81971e103f39f10df4867c123b2a9c2021c6 /Lib
parent3471b1c865130911e7960f7754164a57e0d652c5 (diff)
downloadcpython-191e850053128f726d6562e1d8306dfe5e4aa8aa.zip
cpython-191e850053128f726d6562e1d8306dfe5e4aa8aa.tar.gz
cpython-191e850053128f726d6562e1d8306dfe5e4aa8aa.tar.bz2
Add more tests for the powerset() recipe.
Diffstat (limited to 'Lib')
-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 01409b3..f69ad26 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -1512,6 +1512,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']