mirror of https://github.com/explosion/spaCy.git
Fix vectors test
This commit is contained in:
parent
fdb4b8e456
commit
c047498f87
|
@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
|||
|
||||
from ...vectors import Vectors
|
||||
from ...tokenizer import Tokenizer
|
||||
from ...strings import hash_string
|
||||
from ..util import add_vecs_to_vocab, get_doc
|
||||
|
||||
import numpy
|
||||
|
@ -45,6 +46,7 @@ def test_init_vectors_with_shape(strings):
|
|||
|
||||
def test_get_vector(strings, data):
|
||||
v = Vectors(data=data)
|
||||
strings = [hash_string(s) for s in strings]
|
||||
for i, string in enumerate(strings):
|
||||
v.add(string, row=i)
|
||||
assert list(v[strings[0]]) == list(data[0])
|
||||
|
@ -55,6 +57,7 @@ def test_get_vector(strings, data):
|
|||
def test_set_vector(strings, data):
|
||||
orig = data.copy()
|
||||
v = Vectors(data=data)
|
||||
strings = [hash_string(s) for s in strings]
|
||||
for i, string in enumerate(strings):
|
||||
v.add(string, row=i)
|
||||
assert list(v[strings[0]]) == list(orig[0])
|
||||
|
|
Loading…
Reference in New Issue