MCPcopy Index your code
hub / github.com/python/cpython / test_contains

Method test_contains

Lib/test/test_deque.py:149–167  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

147 self.assertEqual(x >= y, list(x) >= list(y), (x,y))
148
149 def test_contains(self):
150 n = 200
151
152 d = deque(range(n))
153 for i in range(n):
154 self.assertTrue(i in d)
155 self.assertTrue((n+1) not in d)
156
157 # Test detection of mutation during iteration
158 d = deque(range(n))
159 d[n//2] = MutateCmp(d, False)
160 with self.assertRaises(RuntimeError):
161 n in d
162
163 # Test detection of comparison exceptions
164 d = deque(range(n))
165 d[n//2] = BadCmp()
166 with self.assertRaises(RuntimeError):
167 n in d
168
169 def test_contains_count_index_stop_crashes(self):
170 class A:

Callers

nothing calls this directly

Calls 4

MutateCmpClass · 0.85
assertTrueMethod · 0.80
BadCmpClass · 0.70
assertRaisesMethod · 0.45

Tested by

no test coverage detected