From bc72e0e94c7e3a9a853a0b3b382596a66490e84e Mon Sep 17 00:00:00 2001 From: thomashacker Date: Mon, 14 Nov 2022 11:08:06 +0100 Subject: [PATCH] Fix docs and format file --- spacy/tests/doc/test_doc_api.py | 9 ++++----- website/docs/usage/rule-based-matching.md | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spacy/tests/doc/test_doc_api.py b/spacy/tests/doc/test_doc_api.py index f866b1667..f77d54493 100644 --- a/spacy/tests/doc/test_doc_api.py +++ b/spacy/tests/doc/test_doc_api.py @@ -380,9 +380,7 @@ def test_doc_api_serialize(en_tokenizer, text): assert [t.text for t in tokens] == [t.text for t in new_tokens] assert [t.orth for t in tokens] == [t.orth for t in new_tokens] - new_tokens = Doc(tokens.vocab).from_bytes( - tokens.to_bytes() - ) + new_tokens = Doc(tokens.vocab).from_bytes(tokens.to_bytes()) assert tokens.text == new_tokens.text assert [t.text for t in tokens] == [t.text for t in new_tokens] assert [t.orth for t in tokens] == [t.orth for t in new_tokens] @@ -991,10 +989,11 @@ def test_doc_spans_setdefault(en_tokenizer): doc.spans.setdefault("key3", default=SpanGroup(doc, spans=[doc[0:1], doc[1:2]])) assert len(doc.spans["key3"]) == 2 + def test_doc_sentiment_from_bytes_v3_to_v4(): """Test if a doc with sentiment attribute created in v3.x works with '.from_bytes' in v4.x without throwing errors. The sentiment attribute was removed in v4""" - doc_bytes = b'\x89\xa4text\xa5happy\xaaarray_head\x9fGQACKOLMN\xcd\x01\xc4\xcd\x01\xc6I\xcd\x01\xc5JP\xaaarray_body\x85\xc4\x02nd\xc3\xc4\x04type\xa3