mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-27 17:54:39 +03:00
[issue 805] Add regression test and the required fixture
This commit is contained in:
parent
a44da8fb34
commit
35100c8bdd
|
@ -68,6 +68,11 @@ def fi_tokenizer():
|
||||||
return Finnish.Defaults.create_tokenizer()
|
return Finnish.Defaults.create_tokenizer()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def sv_tokenizer():
|
||||||
|
return Swedish.Defaults.create_tokenizer()
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def stringstore():
|
def stringstore():
|
||||||
return StringStore()
|
return StringStore()
|
||||||
|
|
15
spacy/tests/regression/test_issue805.py
Normal file
15
spacy/tests/regression/test_issue805.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# encoding: utf8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
SV_TOKEN_EXCEPTION_TESTS = [
|
||||||
|
('Smörsåsen används bl.a. till fisk', ['Smörsåsen', 'används', 'bl.a.', 'till', 'fisk']),
|
||||||
|
('Jag kommer först kl. 13 p.g.a. diverse förseningar', ['Jag', 'kommer', 'först', 'kl.', '13', 'p.g.a.', 'diverse', 'förseningar'])
|
||||||
|
]
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('text,expected_tokens', SV_TOKEN_EXCEPTION_TESTS)
|
||||||
|
def test_issue805(sv_tokenizer, text, expected_tokens):
|
||||||
|
tokens = sv_tokenizer(text)
|
||||||
|
token_list = [token.text for token in tokens if not token.is_space]
|
||||||
|
assert expected_tokens == token_list
|
Loading…
Reference in New Issue
Block a user