mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
Tidy up tests [ci skip]
This commit is contained in:
parent
aa52305461
commit
399a5803d0
|
@ -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"
|
||||
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user