mirror of
https://github.com/python/cpython.git
synced 2025-09-25 01:43:11 +00:00
Clarify and speedup test.
This commit is contained in:
parent
babc83a27a
commit
c1ac194e94
1 changed files with 3 additions and 2 deletions
|
@ -774,8 +774,9 @@ def _test_sample(n):
|
||||||
population = xrange(n)
|
population = xrange(n)
|
||||||
for k in xrange(n+1):
|
for k in xrange(n+1):
|
||||||
s = sample(population, k)
|
s = sample(population, k)
|
||||||
assert len(dict([(elem,True) for elem in s])) == len(s) == k
|
uniq = dict.fromkeys(s)
|
||||||
assert None not in s
|
assert len(uniq) == len(s) == k
|
||||||
|
assert None not in uniq
|
||||||
|
|
||||||
def _sample_generator(n, k):
|
def _sample_generator(n, k):
|
||||||
# Return a fixed element from the sample. Validates random ordering.
|
# Return a fixed element from the sample. Validates random ordering.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue