From: Mark Dickinson Date: Sun, 24 Jun 2012 10:05:30 +0000 (+0100) Subject: In random's test_seedargs: Make sure to include at least one seed object with a negat... X-Git-Tag: v3.3.0b1~79^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=95aeae01e29de49bf0d47b2442bc656cfe0e2ee1;p=thirdparty%2FPython%2Fcpython.git In random's test_seedargs: Make sure to include at least one seed object with a negative hash. --- diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py index 776d0c4163e9..b5931baf4ef2 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)