mirror of https://github.com/python/cpython
Add more tests for the powerset() recipe.
This commit is contained in:
parent
3471b1c865
commit
191e850053
|
@ -1512,6 +1512,12 @@ perform as purported.
|
||||||
>>> list(powerset([1,2,3]))
|
>>> list(powerset([1,2,3]))
|
||||||
[(), (1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (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'))
|
>>> list(unique_everseen('AAAABBBCCDAABBB'))
|
||||||
['A', 'B', 'C', 'D']
|
['A', 'B', 'C', 'D']
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue