2019-03-07 23:10:07 +00:00
|
|
|
# coding: utf-8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import pytest
|
2019-03-08 12:28:53 +00:00
|
|
|
|
2019-03-07 23:10:07 +00:00
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def i_has(en_tokenizer):
|
|
|
|
doc = en_tokenizer("I has")
|
|
|
|
doc[0].tag_ = "PRP"
|
|
|
|
doc[1].tag_ = "VBZ"
|
|
|
|
return doc
|
|
|
|
|
2019-03-08 12:28:53 +00:00
|
|
|
|
2019-03-07 23:10:07 +00:00
|
|
|
def test_token_morph_id(i_has):
|
|
|
|
assert i_has[0].morph.id
|
|
|
|
assert i_has[1].morph.id != 0
|
|
|
|
assert i_has[0].morph.id != i_has[1].morph.id
|
|
|
|
|
2019-03-08 12:28:53 +00:00
|
|
|
|
2019-03-07 23:10:07 +00:00
|
|
|
def test_morph_props(i_has):
|
|
|
|
assert i_has[0].morph.pron_type == i_has.vocab.strings["PronType_prs"]
|
2019-03-08 00:38:54 +00:00
|
|
|
assert i_has[0].morph.pron_type_ == "PronType_prs"
|
2019-03-07 23:10:07 +00:00
|
|
|
assert i_has[1].morph.pron_type == 0
|
|
|
|
|
|
|
|
|
|
|
|
def test_morph_iter(i_has):
|
|
|
|
assert list(i_has[0].morph) == ["PronType_prs"]
|
|
|
|
assert list(i_has[1].morph) == ["Number_sing", "Person_three", "VerbForm_fin"]
|
2019-03-08 00:38:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_morph_get(i_has):
|
|
|
|
assert i_has[0].morph.get("pron_type") == "PronType_prs"
|