MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_Mapping

Method test_Mapping

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected