mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-19 20:52:23 +03:00
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:
parent
4a9dc00d86
commit
e9626e38c1
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user