| Total Complexity | 2 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import pytest |
||
| 2 | |||
| 3 | from mandos.cli import Commands, What |
||
| 4 | |||
| 5 | from . import get_test_resource |
||
| 6 | |||
| 7 | |||
| 8 | class TestIndicationSearch: |
||
| 9 | def test_find(self): |
||
| 10 | df, triples = Commands.search_for(What.trial, get_test_resource("inchis.txt"), None) |
||
| 11 | assert len(df) == 6 |
||
| 12 | assert len(triples) == 6 |
||
| 13 | assert {t.compound_name.lower() for t in triples} == {"alprazolam"} |
||
| 14 | assert {t.object_id for t in triples} == { |
||
| 15 | "D012559", |
||
| 16 | "D016584", |
||
| 17 | "D003704", |
||
| 18 | "D001008", |
||
| 19 | "D001007", |
||
| 20 | "D003866", |
||
| 21 | } |
||
| 22 | assert {t.object_name.lower() for t in triples} == { |
||
| 23 | "schizophrenia", |
||
| 24 | "panic disorder", |
||
| 25 | "dementia", |
||
| 26 | "anxiety", |
||
| 27 | "depressive disorder", |
||
| 28 | "anxiety disorders", |
||
| 29 | } |
||
| 30 | assert {t.predicate for t in triples} == {"phase-4 indication", "phase-3 indication"} |
||
| 31 | |||
| 32 | def test_cocaine_hcl(self): |
||
| 33 | df, triples = Commands.search_for(What.trial, ["CHEMBL529437"], None) |
||
| 34 | assert len(df) == 1 |
||
| 35 | assert len(triples) == 1 |
||
| 36 | assert triples[0].compound_name.lower() == "cocaine" |
||
| 37 | assert triples[0].compound_id == "CHEMBL370805" |
||
| 38 | assert triples[0].object_id == "D000758" |
||
| 39 | assert triples[0].object_name == "Anesthesia" |
||
| 40 | assert triples[0].predicate == "phase-4 indication" |
||
| 41 | |||
| 42 | |||
| 43 | if __name__ == "__main__": |
||
| 44 | pytest.main() |
||
| 45 |