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

Method test_proxy_call

Lib/test/test_descr.py:5073–5087  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5071 MyClass = meta('MyClass', (), {})
5072
5073 def test_proxy_call(self):
5074 class FakeStr:
5075 __class__ = str
5076
5077 fake_str = FakeStr()
5078 # isinstance() reads __class__
5079 self.assertIsInstance(fake_str, str)
5080
5081 # call a method descriptor
5082 with self.assertRaises(TypeError):
5083 str.split(fake_str)
5084
5085 # call a slot wrapper descriptor
5086 with self.assertRaises(TypeError):
5087 str.__add__(fake_str, "abc")
5088
5089 def test_specialized_method_calls_check_types(self):
5090 # https://github.com/python/cpython/issues/92063

Callers

nothing calls this directly

Calls 5

assertIsInstanceMethod · 0.80
FakeStrClass · 0.70
assertRaisesMethod · 0.45
splitMethod · 0.45
__add__Method · 0.45

Tested by

no test coverage detected