summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_random.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-11-16 16:17:49 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-11-16 16:17:49 (GMT)
commita690a9967e715663b7a421c9ebdad91381cdf1e4 (patch)
tree1c5d9eeef0ac20efe39f1af11a81d745592596d1 /Lib/test/test_random.py
parentd456849f19fa7b00b6560b67c5388a5a6cd89d0a (diff)
downloadcpython-a690a9967e715663b7a421c9ebdad91381cdf1e4.zip
cpython-a690a9967e715663b7a421c9ebdad91381cdf1e4.tar.gz
cpython-a690a9967e715663b7a421c9ebdad91381cdf1e4.tar.bz2
* Migrate set() and frozenset() from the sandbox.
* Install the unittests, docs, newsitem, include file, and makefile update. * Exercise the new functions whereever sets.py was being used. Includes the docs for libfuncs.tex. Separate docs for the types are forthcoming.
Diffstat (limited to 'Lib/test/test_random.py')
-rw-r--r--Lib/test/test_random.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
index 3796c3b..8d005a2 100644
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -6,7 +6,6 @@ import time
import pickle
import warnings
from math import log, exp, sqrt, pi
-from sets import Set
from test import test_support
class TestBasicOps(unittest.TestCase):
@@ -64,9 +63,9 @@ class TestBasicOps(unittest.TestCase):
for k in xrange(N+1):
s = self.gen.sample(population, k)
self.assertEqual(len(s), k)
- uniq = Set(s)
+ uniq = set(s)
self.assertEqual(len(uniq), k)
- self.failUnless(uniq <= Set(population))
+ self.failUnless(uniq <= set(population))
self.assertEqual(self.gen.sample([], 0), []) # test edge case N==k==0
def test_sample_distribution(self):
@@ -89,8 +88,7 @@ class TestBasicOps(unittest.TestCase):
def test_sample_inputs(self):
# SF bug #801342 -- population can be any iterable defining __len__()
- from sets import Set
- self.gen.sample(Set(range(20)), 2)
+ self.gen.sample(set(range(20)), 2)
self.gen.sample(range(20), 2)
self.gen.sample(xrange(20), 2)
self.gen.sample(dict.fromkeys('abcdefghijklmnopqrst'), 2)
@@ -256,8 +254,8 @@ class MersenneTwister_TestBasicOps(TestBasicOps):
def test_rangelimits(self):
for start, stop in [(-2,0), (-(2**60)-2,-(2**60)), (2**60,2**60+2)]:
- self.assertEqual(Set(range(start,stop)),
- Set([self.gen.randrange(start,stop) for i in xrange(100)]))
+ self.assertEqual(set(range(start,stop)),
+ set([self.gen.randrange(start,stop) for i in xrange(100)]))
def test_genrandbits(self):
# Verify cross-platform repeatability
@@ -364,7 +362,7 @@ class TestModule(unittest.TestCase):
def test__all__(self):
# tests validity but not completeness of the __all__ list
- self.failUnless(Set(random.__all__) <= Set(dir(random)))
+ self.failUnless(set(random.__all__) <= set(dir(random)))
def test_main(verbose=None):
testclasses = (WichmannHill_TestBasicOps,