mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
* Add hash tests
This commit is contained in:
parent
d6e07aa922
commit
b555e2dc5d
18
tests/test_hash_table.py
Normal file
18
tests/test_hash_table.py
Normal 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
|
||||
|
Loading…
Reference in New Issue
Block a user