summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2005-03-19 00:00:51 (GMT)
committerRaymond Hettinger <python@rcn.com>2005-03-19 00:00:51 (GMT)
commitd73202c596e730d8bfb22edb1a6c4cc2f0e9ca6f (patch)
tree0bfe624c8356dec97a46644233eae277b641dbbe /Lib
parent4aec61e0fc29217c93acd0615ad54bd081a64658 (diff)
downloadcpython-d73202c596e730d8bfb22edb1a6c4cc2f0e9ca6f.zip
cpython-d73202c596e730d8bfb22edb1a6c4cc2f0e9ca6f.tar.gz
cpython-d73202c596e730d8bfb22edb1a6c4cc2f0e9ca6f.tar.bz2
Apply remove's mutation test after every equality test.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_deque.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/test/test_deque.py b/Lib/test/test_deque.py
index f498124..7e80e8c 100644
--- a/Lib/test/test_deque.py
+++ b/Lib/test/test_deque.py
@@ -19,11 +19,12 @@ class BadCmp:
raise RuntimeError
class MutateCmp:
- def __init__(self, deque):
+ def __init__(self, deque, result):
self.deque = deque
+ self.result = result
def __eq__(self, other):
self.deque.clear()
- return True
+ return self.result
class TestBasic(unittest.TestCase):
@@ -226,11 +227,11 @@ class TestBasic(unittest.TestCase):
self.assert_(x is y)
# Handle evil mutator
- d = deque(['ab'])
- d.extend([MutateCmp(d), 'c'])
- e = deque(d)
- self.assertRaises(IndexError, d.remove, 'c')
- self.assertEqual(d, deque())
+ for match in (True, False):
+ d = deque(['ab'])
+ d.extend([MutateCmp(d, match), 'c'])
+ self.assertRaises(IndexError, d.remove, 'c')
+ self.assertEqual(d, deque())
def test_repr(self):
d = deque(xrange(200))