]> granicus.if.org Git - python/commitdiff
Add more tests for the powerset() recipe.
authorRaymond Hettinger <python@rcn.com>
Tue, 27 Jan 2009 13:26:35 +0000 (13:26 +0000)
committerRaymond Hettinger <python@rcn.com>
Tue, 27 Jan 2009 13:26:35 +0000 (13:26 +0000)
Lib/test/test_itertools.py

index f6a9975b337e669e5583c034799b1e9f0b0feb7e..1ba43f7d18409c2c2e45d71bf79c9e3e8b9a3fc8 100644 (file)
@@ -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']