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

Method test_contains

Lib/test/mapping_tests.py:346–356  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

344 self.assertEqual(list(d.items()), [(1, 2)])
345
346 def test_contains(self):
347 d = self._empty_mapping()
348 self.assertNotIn('a', d)
349 self.assertTrue(not ('a' in d))
350 self.assertTrue('a' not in d)
351 d = self._full_mapping({'a': 1, 'b': 2})
352 self.assertIn('a', d)
353 self.assertIn('b', d)
354 self.assertNotIn('c', d)
355
356 self.assertRaises(TypeError, d.__contains__)
357
358 def test_len(self):
359 BasicTestMappingProtocol.test_len(self)

Callers

nothing calls this directly

Calls 6

assertNotInMethod · 0.80
assertTrueMethod · 0.80
assertInMethod · 0.80
_empty_mappingMethod · 0.45
_full_mappingMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected