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

Method test_method_equal_instances

Lib/test/test_functools.py:3505–3519  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3503 return "forward reference"
3504
3505 def test_method_equal_instances(self):
3506 # gh-127750: Reference to self was cached
3507 class A:
3508 def __eq__(self, other):
3509 return True
3510 def __hash__(self):
3511 return 1
3512 @functools.singledispatchmethod
3513 def t(self, arg):
3514 return self
3515
3516 a = A()
3517 b = A()
3518 self.assertIs(a.t(1), a)
3519 self.assertIs(b.t(2), b)
3520
3521 def test_method_bad_hash(self):
3522 class A:

Callers

nothing calls this directly

Calls 3

tMethod · 0.95
AClass · 0.70
assertIsMethod · 0.45

Tested by

no test coverage detected