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

Method test_abc_bases

Lib/test/test_typing.py:5009–5026  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5007 self.assertNotIsSubclass(dict, MyMapping)
5008
5009 def test_abc_bases(self):
5010 class MM(MutableMapping[str, str]):
5011 def __getitem__(self, k):
5012 return None
5013 def __setitem__(self, k, v):
5014 pass
5015 def __delitem__(self, k):
5016 pass
5017 def __iter__(self):
5018 return iter(())
5019 def __len__(self):
5020 return 0
5021 # this should just work
5022 MM().update()
5023 self.assertIsInstance(MM(), collections.abc.MutableMapping)
5024 self.assertIsInstance(MM(), MutableMapping)
5025 self.assertNotIsInstance(MM(), List)
5026 self.assertNotIsInstance({}, MM)
5027
5028 def test_multiple_bases(self):
5029 class MM1(MutableMapping[str, str], collections.abc.MutableMapping):

Callers

nothing calls this directly

Calls 4

assertIsInstanceMethod · 0.80
assertNotIsInstanceMethod · 0.80
MMClass · 0.70
updateMethod · 0.45

Tested by

no test coverage detected