Fix serialization test

This test was failing not because the thing it was testing wasn't
working, but because of the way span equality works. Span equality
relies on doc equality, and doc equality is object identity, so spans
from different docs will never be equal.
This commit is contained in:
Paul O'Leary McCann 2021-07-14 18:37:34 +09:00
parent 4a9dc00d86
commit e9626e38c1

View File

@ -93,8 +93,10 @@ def test_coref_serialization(nlp):
spans_result2 = doc2.spans spans_result2 = doc2.spans
print(1, [(k, len(v)) for k, v in spans_result.items()]) print(1, [(k, len(v)) for k, v in spans_result.items()])
print(2, [(k, len(v)) for k, v in spans_result2.items()]) print(2, [(k, len(v)) for k, v in spans_result2.items()])
# Note: spans do not compare equal because docs are different and docs
# use object identity for equality
for k, v in spans_result.items(): for k, v in spans_result.items():
assert spans_result[k] == spans_result2[k] assert str(spans_result[k]) == str(spans_result2[k])
# assert spans_result == spans_result2 # assert spans_result == spans_result2