Exemplo n.º 1
0
 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,
     }
Exemplo n.º 2
0
 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,
     }
Exemplo n.º 3
0
 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",
     }
Exemplo n.º 4
0
 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
     }
Exemplo n.º 5
0
 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
     }
Exemplo n.º 6
0
 def test_definition_not_found(self):
     word = fakes.fake_value()
     assert define_word(fakes.course1, word, is_in_target_language=False) == {
         "word": word
     }
Exemplo n.º 7
0
 def test_definition_not_found(self):
     word = fakes.fake_value()
     assert define_word(fakes.course1, word, reverse=False) == {
         "word": word
     }