Skip to content

Commit

Permalink
Added some basic tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurav committed Nov 1, 2024
1 parent e2d9e81 commit 12113ef
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,37 @@ def test_autocomplete():
assert syns[1]["label"] == 'Alzheimer disease 6'
assert syns[1]["types"][0] == "biolink:Disease"


def test_synonyms():
"""
Test the /synonyms endpoints -- these are used to look up all the information we know about a preferred CURIE.
"""
client = TestClient(app)
response = client.get("/synonyms", params={'preferred_curies': ['CHEBI:74925', 'NONE:1234', 'MONDO:0000828']})

results = response.json()
chebi_74925_results = results['CHEBI:74925']
assert chebi_74925_results['curie'] == 'CHEBI:74925'
assert chebi_74925_results['preferred_label'] == 'BACE1 inhibitor'

none_1234_results = response.json()
assert none_1234_results['NONE:1234'] == {}

mondo_0000828_results = response.json()
assert mondo_0000828_results['curie'] == 'MONDO:0000828'
assert mondo_0000828_results['preferred_label'] == 'juvenile-onset Parkinson disease'

response = client.post("/synonyms", json={'preferred_curies': ['MONDO:0000828', 'NONE:1234', 'CHEBI:74925']})

results = response.json()
chebi_74925_results = results['CHEBI:74925']
assert chebi_74925_results['curie'] == 'CHEBI:74925'
assert chebi_74925_results['preferred_label'] == 'BACE1 inhibitor'

none_1234_results = response.json()
assert none_1234_results['NONE:1234'] == {}

mondo_0000828_results = response.json()
assert mondo_0000828_results['curie'] == 'MONDO:0000828'
assert mondo_0000828_results['preferred_label'] == 'juvenile-onset Parkinson disease'

0 comments on commit 12113ef

Please sign in to comment.