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

Method test_hamt_getitem_1

Lib/test/test_context.py:1092–1113  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1090 AA in h
1091
1092 def test_hamt_getitem_1(self):
1093 A = HashKey(100, 'A')
1094 AA = HashKey(100, 'A')
1095
1096 B = HashKey(101, 'B')
1097
1098 h = hamt()
1099 h = h.set(A, 1)
1100
1101 self.assertEqual(h[A], 1)
1102 self.assertEqual(h[AA], 1)
1103
1104 with self.assertRaises(KeyError):
1105 h[B]
1106
1107 with self.assertRaises(EqError):
1108 with HaskKeyCrasher(error_on_eq=True):
1109 h[AA]
1110
1111 with self.assertRaises(HashingError):
1112 with HaskKeyCrasher(error_on_hash=True):
1113 h[AA]
1114
1115
1116if __name__ == "__main__":

Callers

nothing calls this directly

Calls 5

HashKeyClass · 0.85
HaskKeyCrasherClass · 0.85
setMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected