2018-01-15 14:54:25 +00:00
|
|
|
'''Test comparison against None doesn't cause segfault'''
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from ...tokens import Doc
|
|
|
|
from ...vocab import Vocab
|
|
|
|
|
|
|
|
def test_issue1757():
|
|
|
|
doc = Doc(Vocab(), words=['a', 'b', 'c'])
|
|
|
|
assert not doc[0] < None
|
|
|
|
assert not doc[0] == None
|
|
|
|
assert doc[0] >= None
|
|
|
|
span = doc[:2]
|
|
|
|
assert not span < None
|
|
|
|
assert not span == None
|
|
|
|
assert span >= None
|
2018-01-15 14:55:15 +00:00
|
|
|
lex = doc.vocab['a']
|
2018-01-15 14:54:25 +00:00
|
|
|
assert not lex == None
|
|
|
|
assert not lex < None
|