mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-10 16:22:29 +03:00
* Unhack serialization api tests
This commit is contained in:
parent
c4f20847da
commit
847c08e411
|
@ -5,7 +5,8 @@ from spacy.tokens import Doc
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
def mest_getitem(EN):
|
@pytest.mark.models
|
||||||
|
def test_getitem(EN):
|
||||||
tokens = EN(u'Give it back! He pleaded.')
|
tokens = EN(u'Give it back! He pleaded.')
|
||||||
assert tokens[0].orth_ == 'Give'
|
assert tokens[0].orth_ == 'Give'
|
||||||
assert tokens[-1].orth_ == '.'
|
assert tokens[-1].orth_ == '.'
|
||||||
|
@ -13,7 +14,8 @@ def mest_getitem(EN):
|
||||||
tokens[len(tokens)]
|
tokens[len(tokens)]
|
||||||
|
|
||||||
|
|
||||||
def mest_serialize(EN):
|
@pytest.mark.models
|
||||||
|
def test_serialize(EN):
|
||||||
tokens = EN(u'Give it back! He pleaded.')
|
tokens = EN(u'Give it back! He pleaded.')
|
||||||
packed = tokens.to_bytes()
|
packed = tokens.to_bytes()
|
||||||
new_tokens = Doc(EN.vocab).from_bytes(packed)
|
new_tokens = Doc(EN.vocab).from_bytes(packed)
|
||||||
|
@ -22,6 +24,7 @@ def mest_serialize(EN):
|
||||||
assert [t.orth for t in tokens] == [t.orth for t in new_tokens]
|
assert [t.orth for t in tokens] == [t.orth for t in new_tokens]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.models
|
||||||
def test_serialize_whitespace(EN):
|
def test_serialize_whitespace(EN):
|
||||||
tokens = EN(u' Give it back! He pleaded. ')
|
tokens = EN(u' Give it back! He pleaded. ')
|
||||||
packed = tokens.to_bytes()
|
packed = tokens.to_bytes()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user