[cad161]: / tests / pipelines / test_pipelines.py

Download this file

33 lines (21 with data), 762 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import pytest
import edsnlp
def test_pipelines(doc):
assert len(doc.ents) == 3
patient, _, anomalie = doc.ents
assert not patient._.negation
assert anomalie._.negation
assert not doc[0]._.history
def test_import_all():
import edsnlp.pipes
for name in dir(edsnlp.pipes):
if not name.startswith("_") and "endlines" not in name:
try:
getattr(edsnlp.pipes, name)
except (ImportError, AttributeError) as e:
if "torch" in str(e):
pass
def test_non_existing_pipe():
with pytest.raises(AttributeError) as e:
getattr(edsnlp.pipes, "non_existing_pipe")
assert str(e.value) == "module edsnlp.pipes has no attribute non_existing_pipe"