Skip to content

Commit

Permalink
✅ Updated tests
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Martinez <[email protected]>
  • Loading branch information
marmg committed Sep 6, 2023
1 parent 50ba7a0 commit 53b1a07
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@


class DummyLinkerEnd2End(Linker):

@property
def is_end2end(self) -> bool:
return True

def predict(self, docs: Iterator[Doc], batch_size=None):
return [[Span(187, 165, label='label', score=0.9),
Span(111, 129, label='label', score=0.9)] for doc in docs]
Expand Down
14 changes: 14 additions & 0 deletions zshot/tests/utils/test_data_models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pytest
import spacy

from zshot.tests.config import EX_DATASET_RELATIONS
Expand Down Expand Up @@ -29,6 +30,19 @@ def test_span():
assert repr(s) == f"{s.label}, {s.start}, {s.end}, {s.score}"

# From Dict
with pytest.raises(ValueError):
s1 = Span.from_dict({})
with pytest.raises(ValueError):
s1 = Span.from_dict({'start': 0})
with pytest.raises(ValueError):
s1 = Span.from_dict({'start': 0, 'end': 0})

s1 = Span.from_dict(EX_DATASET_RELATIONS['sentence_entities'][0][0])
assert type(s1) is Span
assert s1.start == 165
assert s1.end == 187
assert s1.label == 'Q5034838'

s1 = Span.from_dict(EX_DATASET_RELATIONS['sentence_entities'][0][0])
assert type(s1) is Span
assert s1.start == 165
Expand Down

0 comments on commit 53b1a07

Please sign in to comment.