From 3c993e767164dd97ba774d496974fbc510fbaec2 Mon Sep 17 00:00:00 2001 From: Rafael Goncalves Date: Fri, 13 Oct 2023 11:20:03 -0400 Subject: [PATCH] Add tests for include_unmapped feature --- test/simple_tests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/simple_tests.py b/test/simple_tests.py index 0a9e5e2..7e65169 100644 --- a/test/simple_tests.py +++ b/test/simple_tests.py @@ -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