projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
babc83a
)
Clarify and speedup test.
author
Raymond Hettinger
<python@rcn.com>
Sat, 7 Dec 2002 09:25:05 +0000
(09:25 +0000)
committer
Raymond Hettinger
<python@rcn.com>
Sat, 7 Dec 2002 09:25:05 +0000
(09:25 +0000)
Lib/random.py
patch
|
blob
|
history
diff --git
a/Lib/random.py
b/Lib/random.py
index 16ec3658ffc4852b0581357f3af06585f407ea88..057571a1b2cd228c720ea4f747d5a8115e0b1a6b 100644
(file)
--- a/
Lib/random.py
+++ b/
Lib/random.py
@@
-774,8
+774,9
@@
def _test_sample(n):
population = xrange(n)
for k in xrange(n+1):
s = sample(population, k)
- assert len(dict([(elem,True) for elem in s])) == len(s) == k
- assert None not in s
+ uniq = dict.fromkeys(s)
+ assert len(uniq) == len(s) == k
+ assert None not in uniq
def _sample_generator(n, k):
# Return a fixed element from the sample. Validates random ordering.