MCPcopy Create free account
hub / github.com/RustPython/RustPython / Key3

Class Key3

Lib/test/test_dict.py:1487–1496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1485 eq_count = 0
1486 # This class compares equal to the string 'key3'
1487 class Key3:
1488 def __hash__(self):
1489 return hash('key3')
1490
1491 def __eq__(self, other):
1492 nonlocal eq_count
1493 if isinstance(other, Key3) or isinstance(other, str) and other == 'key3':
1494 eq_count += 1
1495 return True
1496 return False
1497
1498 key3_1 = StrSub('key3')
1499 key3_2 = Key3()

Callers 1

test_str_nonstrMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_str_nonstrMethod · 0.68