Skip to content

Commit

Permalink
Add tests for include_unmapped feature
Browse files Browse the repository at this point in the history
  • Loading branch information
rsgoncalves committed Oct 13, 2023
1 parent 66cc573 commit 3c993e7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/simple_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,16 @@ def test_mapping_with_min_score_filter(self):
term_type=OntologyTermType.ANY, min_score=min_score)
assert (df_leven[self.MAPPING_SCORE_COLUMN] >= min_score).all()

def test_include_unmapped_terms(self):
df = text2term.map_terms(["asthma", "margarita"], target_ontology="EFO", use_cache=True, mapper=Mapper.TFIDF,
incl_unmapped=True, min_score=0.8)
assert df[self.TAGS_COLUMN].str.contains("unmapped").any()

def test_include_unmapped_terms_when_no_mappings_are_returned(self):
df = text2term.map_terms(["mojito", "margarita"], target_ontology="EFO", use_cache=True, mapper=Mapper.TFIDF,
incl_unmapped=True, min_score=0.8)
assert df[self.TAGS_COLUMN].str.contains("unmapped").any()

def drop_source_term_ids(self, df):
# Unless specified, source term IDs are randomly generated UUIDs. We have to drop the ID column to be able to
# get a meaningful diff between two dataframes. Otherwise, the dataframes would always differ because of the IDs
Expand Down

0 comments on commit 3c993e7

Please sign in to comment.