Add tests for token comparison, re Issue #631

This commit is contained in:
Matthew Honnibal 2017-01-09 19:09:59 +01:00
parent c9fdd9917c
commit 18c3c2d05c

View File

@ -4,9 +4,21 @@ from spacy.tokens import Doc
from spacy.en import English from spacy.en import English
import numpy import numpy
from spacy.attrs import HEAD from spacy.attrs import HEAD
from ...vocab import Vocab
from ...tokens.doc import Doc
import pytest import pytest
def test_tokens_compare_by_string_position():
vocab = Vocab()
doc = Doc(vocab, [u'one', u'two', u'three'])
one, two, three = doc
assert one < two < three
assert not one > two
assert two > one
assert two <= three
assert three >= one
@pytest.mark.models @pytest.mark.models
def test_getitem(EN): def test_getitem(EN):