コード例 #1
0
 def test_search_keyword(self):
     vocab = Vocabulary('VOCAB MOCK')
     vocab.get_list = MagicMock(return_value=self.test_list)
     self.assertEqual(vocab.search('dog'), [self.dog])
     self.assertEqual(
         vocab.search('Animal'),
         [self.cat, self.cat2, self.animal, self.dog, self.mouse])
コード例 #2
0
 def test_search_keyword(self):
     vocab = Vocabulary('VOCAB MOCK')
     vocab.get_list = MagicMock(return_value=self.test_list)
     self.assertEqual(vocab.search('dog'), [self.dog])
     self.assertEqual(vocab.search('Animal'), [self.cat,
                                               self.animal,
                                               self.dog,
                                               self.mouse])
コード例 #3
0
 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)
コード例 #4
0
 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')
コード例 #5
0
 def test_no_duplicate_in_search(self):
     vocab = Vocabulary('VOCAB MOCK')
     vocab.get_list = MagicMock(return_value=self.test_list)
     self.assertEqual(vocab.search('Cat'), [self.cat, self.cat2])
コード例 #6
0
 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)
コード例 #7
0
 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')