Total Complexity | 2 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import pytest |
||
2 | from pocketutils.core.dot_dict import NestedDotDict |
||
3 | |||
4 | from mandos.chembl_api import ChemblApi, ChemblEntrypoint, ChemblFilterQuery |
||
5 | |||
6 | |||
7 | class TestChemblApi: |
||
8 | def test_mocked(self): |
||
9 | api = ChemblApi.mock({"target": ChemblEntrypoint.mock({"DAT": {"x": ""}})}) |
||
10 | dotdict = NestedDotDict({"x": ""}) |
||
11 | assert api.target is not None |
||
12 | assert api.target.get("DAT") is not None |
||
13 | assert isinstance(api.target.get("DAT"), NestedDotDict) |
||
14 | assert api.target.get("DAT") == dotdict |
||
15 | with pytest.raises(KeyError): |
||
16 | assert api.target.get("fasw") |
||
17 | assert isinstance(api.target.filter(), ChemblFilterQuery) |
||
18 | assert isinstance(api.target.filter().only([]), ChemblFilterQuery) |
||
19 | z = list(api.target.filter().only([])) |
||
20 | assert z == [dotdict] |
||
21 | |||
22 | |||
23 | if __name__ == "__main__": |
||
24 | pytest.main() |
||
25 |