summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_random.py
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2012-06-24 10:05:30 (GMT)
committerMark Dickinson <mdickinson@enthought.com>2012-06-24 10:05:30 (GMT)
commit95aeae01e29de49bf0d47b2442bc656cfe0e2ee1 (patch)
tree0079b461504f19ab2f2fb984e8b39f3b9e6659ea /Lib/test/test_random.py
parentb9831ab63c064baf4e55c22f314ca801bd0fe85e (diff)
downloadcpython-95aeae01e29de49bf0d47b2442bc656cfe0e2ee1.zip
cpython-95aeae01e29de49bf0d47b2442bc656cfe0e2ee1.tar.gz
cpython-95aeae01e29de49bf0d47b2442bc656cfe0e2ee1.tar.bz2
In random's test_seedargs: Make sure to include at least one seed object with a negative hash.
Diffstat (limited to 'Lib/test/test_random.py')
-rw-r--r--Lib/test/test_random.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
index 776d0c4..b5931ba 100644
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -34,8 +34,12 @@ class TestBasicOps(unittest.TestCase):
self.assertEqual(randseq, self.randomlist(N))
def test_seedargs(self):
+ # Seed value with a negative hash.
+ class MySeed(object):
+ def __hash__(self):
+ return -1729
for arg in [None, 0, 0, 1, 1, -1, -1, 10**20, -(10**20),
- 3.14, 1+2j, 'a', tuple('abc')]:
+ 3.14, 1+2j, 'a', tuple('abc'), MySeed()]:
self.gen.seed(arg)
for arg in [list(range(3)), dict(one=1)]:
self.assertRaises(TypeError, self.gen.seed, arg)