def test_skips_empty_definition(self): word = fakes.fake_value() my_course = fakes.customize(fakes.course1, dictionary=[ DictionaryItem( word=word, definition="", is_in_target_language=False ), ]) assert define_word(my_course, word, is_in_target_language=False) == { "word": word, }
def test_doesnt_include_definition_with_different_is_in_target_language(self): word = fakes.fake_value() meaning = fakes.fake_value() is_in_target_language = fakes.fake_value() my_course = fakes.customize(fakes.course1, dictionary=[ DictionaryItem( word=word, definition=meaning, is_in_target_language=False ), ]) assert define_word(my_course, word, is_in_target_language=is_in_target_language) == { "word": word, }
def test_doesnt_include_definition_with_different_word(self): word = fakes.fake_value() meaning = fakes.fake_value() is_in_target_language = fakes.fake_value() my_course = Course( **{ **(fakes.course1._asdict()), "dictionary": [ DictionaryItem( word=word, definition=meaning, is_in_target_language=is_in_target_language ), ] }, ) assert define_word(my_course, "asd", is_in_target_language=is_in_target_language) == { "word": "asd", }
def test_skips_non_matching_definitions(self): word = fakes.fake_value() meaning = fakes.fake_value() is_in_target_language = fakes.fake_value() my_course = fakes.customize(fakes.course1, dictionary=[ DictionaryItem( word=None, definition=None, is_in_target_language=None ), DictionaryItem( word=word, definition=meaning, is_in_target_language=is_in_target_language ), ]) assert define_word(my_course, word, is_in_target_language=is_in_target_language) == { "word": word, "definition": meaning }
def test_includes_definition(self): word = fakes.fake_value() meaning = fakes.fake_value() is_in_target_language = fakes.fake_value() my_course = Course( **{ **(fakes.course1._asdict()), "dictionary": [ DictionaryItem( word=word, definition=meaning, is_in_target_language=is_in_target_language ), ] }, ) assert define_word(my_course, word, is_in_target_language=is_in_target_language) == { "word": word, "definition": meaning }
def test_definition_not_found(self): word = fakes.fake_value() assert define_word(fakes.course1, word, is_in_target_language=False) == { "word": word }
def test_definition_not_found(self): word = fakes.fake_value() assert define_word(fakes.course1, word, reverse=False) == { "word": word }