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

Method test_Mapping

Lib/test/test_collections.py:1843–1856  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1841 self.assertEqual(hash(fs), Set._hash(fs), msg=s)
1842
1843 def test_Mapping(self):
1844 for sample in [dict]:
1845 self.assertIsInstance(sample(), Mapping)
1846 self.assertIsSubclass(sample, Mapping)
1847 self.validate_abstract_methods(Mapping, '__iter__', '__len__', '__getitem__')
1848 class MyMapping(Mapping):
1849 def __len__(self):
1850 return 0
1851 def __getitem__(self, i):
1852 raise IndexError
1853 def __iter__(self):
1854 return iter(())
1855 self.validate_comparison(MyMapping())
1856 self.assertRaises(TypeError, reversed, MyMapping())
1857
1858 def test_MutableMapping(self):
1859 for sample in [dict]:

Callers

nothing calls this directly

Calls 7

sampleFunction · 0.85
assertIsInstanceMethod · 0.80
assertIsSubclassMethod · 0.80
validate_comparisonMethod · 0.80
MyMappingClass · 0.70
assertRaisesMethod · 0.45

Tested by

no test coverage detected