diff --git a/tests/test_hash_table.py b/tests/test_hash_table.py new file mode 100644 index 000000000..2ea7d3797 --- /dev/null +++ b/tests/test_hash_table.py @@ -0,0 +1,18 @@ +import pytest + +from spacy._hashing import FixedTable + + +def test_insert(): + table = FixedTable(20) + table[5] = 10 + assert table.bucket(5) == 5 + assert table[4] == 0 + assert table[5] == 10 + +def test_clobber(): + table = FixedTable(10) + table[9] = 1 + assert table.bucket(9) == 9 + assert table.bucket(19) == 9 +