Add more tests for the powerset() recipe.

This commit is contained in:
Raymond Hettinger 2009-01-27 13:26:35 +00:00
parent 2f6c2e03a8
commit 560f9a8a90
1 changed files with 6 additions and 0 deletions

View 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']