Modernise add vectors vocab test

This commit is contained in:
Ines Montani 2017-01-12 15:09:49 +01:00
parent 89525ef345
commit d7bd57abdf

View File

@ -1,12 +1,14 @@
# coding: utf-8
from __future__ import unicode_literals
import numpy import numpy
import pytest
import spacy.en
def test_add_vector(): @pytest.mark.parametrize('text', ["Hello"])
vocab = spacy.en.English.Defaults.create_vocab() def test_vocab_add_vector(en_vocab, text):
vocab.resize_vectors(10) en_vocab.resize_vectors(10)
lex = vocab[u'Hello'] lex = en_vocab[text]
lex.vector = numpy.ndarray((10,), dtype='float32') lex.vector = numpy.ndarray((10,), dtype='float32')
lex = vocab[u'Hello'] lex = en_vocab[text]
assert lex.vector.shape == (10,) assert lex.vector.shape == (10,)