def _get_raw_dictionary_item(course, word, is_in_target_language): """ Find the matching raw dictionary item for a word. """ dictionary_item = list( filter( lambda item: clean_word(item.word).lower() == clean_word(word).lower( ) and item.is_in_target_language == is_in_target_language, course.dictionary)) return dictionary_item[0] if dictionary_item else None
def test_weird_english_posessive(self): assert clean_word("cats'") == "cats'"
def test_removes_exclamation_mark(self): assert clean_word("ba-ar!") == "ba-ar"
def test_doesnt_remove_parts_of_word_2(self): assert clean_word("L'Hospitalet") == "L'Hospitalet"
def test_doesnt_remove_parts_of_word_1(self): assert clean_word("ba-ar") == "ba-ar"
def test_removes_comma(self): assert clean_word("foo,") == "foo"
def test_removes_parentheses(self): assert clean_word("(foo") == "foo"
def test_empty_string(self): assert clean_word("") == ""