Tidy up tests [ci skip]

This commit is contained in:
Ines Montani 2019-02-24 19:02:16 +01:00
parent aa52305461
commit 399a5803d0
2 changed files with 5 additions and 5 deletions

View File

@ -270,16 +270,16 @@ def test_doc_retokenize_merge_extension_attrs(en_vocab):
attrs = {"lemma": "hello world", "_": {"a": True, "b": "1"}}
retokenizer.merge(doc[0:2], attrs=attrs)
assert doc[0].lemma_ == "hello world"
assert doc[0]._.a == True
assert doc[0]._.a is True
assert doc[0]._.b == "1"
# Test bulk merging
doc = Doc(en_vocab, words=["hello", "world", "!", "!"])
with doc.retokenize() as retokenizer:
retokenizer.merge(doc[0:2], attrs={"_": {"a": True, "b": "1"}})
retokenizer.merge(doc[2:4], attrs={"_": {"a": None, "b": "2"}})
assert doc[0]._.a == True
assert doc[0]._.a is True
assert doc[0]._.b == "1"
assert doc[1]._.a == None
assert doc[1]._.a is None
assert doc[1]._.b == "2"

View File

@ -137,10 +137,10 @@ def test_doc_retokenize_split_extension_attrs(en_vocab):
attrs = {"lemma": ["los", "angeles"], "_": underscore}
retokenizer.split(doc[0], ["Los", "Angeles"], heads, attrs=attrs)
assert doc[0].lemma_ == "los"
assert doc[0]._.a == True
assert doc[0]._.a is True
assert doc[0]._.b == "1"
assert doc[1].lemma_ == "angeles"
assert doc[1]._.a == False
assert doc[1]._.a is False
assert doc[1]._.b == "2"