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

Method test_hash_eq

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

Source from the content-addressed store, hash-verified

9558 L[int, float]
9559
9560 def test_hash_eq(self):
9561 self.assertEqual(len({Annotated[int, 4, 5], Annotated[int, 4, 5]}), 1)
9562 self.assertNotEqual(Annotated[int, 4, 5], Annotated[int, 5, 4])
9563 self.assertNotEqual(Annotated[int, 4, 5], Annotated[str, 4, 5])
9564 self.assertNotEqual(Annotated[int, 4], Annotated[int, 4, 4])
9565 self.assertEqual(
9566 {Annotated[int, 4, 5], Annotated[int, 4, 5], Annotated[T, 4, 5]},
9567 {Annotated[int, 4, 5], Annotated[T, 4, 5]}
9568 )
9569 # Unhashable `metadata` raises `TypeError`:
9570 a1 = Annotated[int, []]
9571 with self.assertRaises(TypeError):
9572 hash(a1)
9573
9574 class A:
9575 __hash__ = None
9576 a2 = Annotated[int, A()]
9577 with self.assertRaises(TypeError):
9578 hash(a2)
9579
9580 def test_instantiate(self):
9581 class C:

Callers

nothing calls this directly

Calls 6

lenFunction · 0.85
hashFunction · 0.85
assertNotEqualMethod · 0.80
AClass · 0.70
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected