Merged revisions 74196 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k ........ r74196 | benjamin.peterson | 2009-07-25 03:02:01 +0200 (Sa, 25 Jul 2009) | 1 line account for range() py3k change ........
This commit is contained in:
parent
4a3b309509
commit
a08a3c514d
|
@ -105,13 +105,13 @@ Here is a short script to test three functions from the :mod:`random` module::
|
||||||
class TestSequenceFunctions(unittest.TestCase):
|
class TestSequenceFunctions(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.seq = range(10)
|
self.seq = list(range(10))
|
||||||
|
|
||||||
def test_shuffle(self):
|
def test_shuffle(self):
|
||||||
# make sure the shuffled sequence does not lose any elements
|
# make sure the shuffled sequence does not lose any elements
|
||||||
random.shuffle(self.seq)
|
random.shuffle(self.seq)
|
||||||
self.seq.sort()
|
self.seq.sort()
|
||||||
self.assertEqual(self.seq, range(10))
|
self.assertEqual(self.seq, list(range(10)))
|
||||||
|
|
||||||
def test_choice(self):
|
def test_choice(self):
|
||||||
element = random.choice(self.seq)
|
element = random.choice(self.seq)
|
||||||
|
|
Loading…
Reference in New Issue