def test_getonlydef(self):
     word = 'cane'
     defs = get_definition(word, all_data=False)
     assert type(defs) is list
     assert len(defs) > 0
     limit_defs = get_definition(word, limit=1, all_data=False)
     assert len(limit_defs) == 1
 def test_errors(self):
     with pytest.raises(exceptions.WordNotFoundError):
         get_definition('nfdifneif')
     with pytest.raises(exceptions.WordNotFoundError):
         get_definition('afefemmm')
     with pytest.raises(exceptions.WordNotFoundError):
         scraper.get_lemma('adaff')
Пример #3
0
 def test_alldata(self):
     word = 'albero'
     data = get_definition(word)
     assert type(data) is dict
     for key in data.keys():
         assert data[key] is not None
     for letter in data['lemma']:
         assert letter != ' '
Пример #4
0
 def test_verb(self):
     word = 'essere'
     data = get_definition(word)
     assert type(data) is dict
     assert len(data) > 0
Пример #5
0
 def test_one_syllable(self):
     word = 'a'
     data = get_definition(word)
     assert type(data) is dict
     assert len(data) > 0
     assert len(data['sillabe']) == 1
Пример #6
0
 def test_specialcharacter(self):
     word = 'perchè'
     data = get_definition(word)
     assert type(data) is dict
     assert len(data) > 0