mirror of https://github.com/explosion/spaCy.git
* Add hash tests
This commit is contained in:
parent
d6e07aa922
commit
b555e2dc5d
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue