[Python-checkins] r69023 - python/trunk/Lib/test/test_itertools.py

raymond.hettinger python-checkins at python.org
Tue Jan 27 14:26:35 CET 2009


Author: raymond.hettinger
Date: Tue Jan 27 14:26:35 2009
New Revision: 69023

Log:
Add more tests for the powerset() recipe.

Modified:
   python/trunk/Lib/test/test_itertools.py

Modified: python/trunk/Lib/test/test_itertools.py
==============================================================================
--- python/trunk/Lib/test/test_itertools.py	(original)
+++ python/trunk/Lib/test/test_itertools.py	Tue Jan 27 14:26:35 2009
@@ -1491,6 +1491,12 @@
 >>> 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']
 


More information about the Python-checkins mailing list