diff options
| author | Neal Norwitz <nnorwitz@gmail.com> | 2006-09-05 01:54:06 (GMT) |
|---|---|---|
| committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-09-05 01:54:06 (GMT) |
| commit | d3da7d394a64f3894b625842da4e5cc2f13bac08 (patch) | |
| tree | 8f6985356ef22ec5910cef7443b217e8099b44db /Lib/test/test_mutants.py | |
| parent | 8568752268bf721228ca989a2b572d4e3bf6275a (diff) | |
| download | cpython-d3da7d394a64f3894b625842da4e5cc2f13bac08.zip cpython-d3da7d394a64f3894b625842da4e5cc2f13bac08.tar.gz cpython-d3da7d394a64f3894b625842da4e5cc2f13bac08.tar.bz2 | |
Fix SF bug #1546288, crash in dict_equal
Diffstat (limited to 'Lib/test/test_mutants.py')
| -rw-r--r-- | Lib/test/test_mutants.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_mutants.py b/Lib/test/test_mutants.py index df58944..a219450 100644 --- a/Lib/test/test_mutants.py +++ b/Lib/test/test_mutants.py @@ -91,12 +91,17 @@ class Horrid: self.hashcode = random.randrange(1000000000) def __hash__(self): + return 42 return self.hashcode def __cmp__(self, other): maybe_mutate() # The point of the test. return cmp(self.i, other.i) + def __eq__(self, other): + maybe_mutate() # The point of the test. + return self.i == other.i + def __repr__(self): return "Horrid(%d)" % self.i @@ -132,7 +137,10 @@ def test_one(n): while dict1 and len(dict1) == len(dict2): if verbose: print ".", - c = cmp(dict1, dict2) + if random.random() < 0.5: + c = cmp(dict1, dict2) + else: + c = dict1 == dict2 if verbose: print |
