def test_find_keyword(self): vocab = Vocabulary('VOCAB MOCK') vocab.get_list = MagicMock(return_value=self.test_list) self.assertEqual(vocab.find_keyword('dog'), self.dog) self.assertEqual(vocab.find_keyword('Animal'), self.animal)
def test_find_keyword_not_found(self): vocab = Vocabulary('VOCAB MOCK') vocab.get_list = MagicMock(return_value=self.test_list) with self.assertRaises(IndexError): vocab.find_keyword('Horse')
def test_find_keyword_get_list_not_implemented(self): vocab = Vocabulary('VOCAB MOCK') with self.assertRaises(NotImplementedError): vocab.find_keyword('an item')