* Add hash tests

This commit is contained in:
Matthew Honnibal 2014-08-02 21:58:31 +01:00
parent d6e07aa922
commit b555e2dc5d
1 changed files with 18 additions and 0 deletions

18
tests/test_hash_table.py Normal file
View File

@ -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