Skip to content

Commit

Permalink
fix: avoid downloading model for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethEnevoldsen committed Oct 18, 2023
1 parent 559fe7d commit 340d6f0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/test_relationextraction_component.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import pytest

from conspiracies.relationextraction import SpacyRelationExtractor # noqa F401

from .utils import nlp_da # noqa F401


@pytest.mark.skip(reason="Avoid downloading the model on GitHub actions")
def test_relationextraction_component_pipe(nlp_da): # noqa F811
test_sents = [
"Pernille Blume vinder delt EM-sølv i Ungarn.",
Expand All @@ -22,6 +25,7 @@ def test_relationextraction_component_pipe(nlp_da): # noqa F811
print(d.text, "\n", d._.relation_triplets)


@pytest.mark.skip(reason="Avoid downloading the model on GitHub actions")
def test_relation_extraction_component_single(nlp_da): # noqa F811
nlp_da.add_pipe("relation_extractor", config={"confidence_threshold": 1.8})
doc = nlp_da("Obama is the former president of the United States.")
Expand All @@ -48,12 +52,14 @@ def test_relation_extraction_multi_sentence(nlp_da): # noqa F811
]


@pytest.mark.skip(reason="Avoid downloading the model on GitHub actions")
def test_relation_extraction_empty_string(nlp_da): # noqa F811
nlp_da.add_pipe("relation_extractor")
doc = nlp_da("")
assert doc._.relation_triplets == []


@pytest.mark.skip(reason="Avoid downloading the model on GitHub actions")
def test_relation_extraction_no_extracted_relation(nlp_da): # noqa F811
nlp_da.add_pipe("relation_extractor")
doc = nlp_da("Ingen relation")
Expand Down

0 comments on commit 340d6f0

Please sign in to comment.