"""test_hash_contract.py""" from __future__ import annotations from hash_contract import Point, eq_only_error, mutated_key_is_lost, unhashable_error def test_unhashable_errors() -> None: assert "unhashable type: 'list'" in unhashable_error() assert "unhashable type" in eq_only_error() def test_equal_objects_are_one_key() -> None: table = {Point(1, 2): "a"} table[Point(1, 2)] = "b" assert len(table) == 1 assert table[Point(1, 2)] == "b" def test_mutating_key_breaks_lookup() -> None: assert mutated_key_is_lost() is True