Exemple #1
0
 def test_word_storage_put_existing(self):
     """existing word is not added to storage"""
     word_storage = WordStorage()
     word = 'word'
     word_storage.storage = {'word': 1}
     word_storage.put(word)
     self.assertEqual(word_storage.storage, {'word': 1})
Exemple #2
0
 def test_word_storage_get_original_id_not_num(self):
     """ideal case for get_id_of"""
     word_storage = WordStorage()
     word_storage.storage = {'word': 1}
     self.assertEqual(word_storage.get_original_by(None), 'UNK')
Exemple #3
0
 def test_word_storage_get_original_by_not_in_storage(self):
     """id not in storage get_original_by"""
     word_storage = WordStorage()
     word_storage.storage = {'word': 1}
     self.assertEqual(word_storage.get_original_by(2), 'UNK')
Exemple #4
0
 def test_word_storage_get_original_by_ideal(self):
     """ideal case for get_original_by"""
     word_storage = WordStorage()
     word_storage.storage = {'word': 1}
     self.assertEqual(word_storage.get_original_by(1), 'word')
Exemple #5
0
 def test_word_storage_get_id_of_word_not_in_storage(self):
     """word not in storage"""
     word_storage = WordStorage()
     word_storage.storage = {'word': 1}
     self.assertEqual(word_storage.get_id_of('another'), -1)
Exemple #6
0
 def test_word_storage_get_id_of_not_str(self):
     """id is not str  get_id_of"""
     word_storage = WordStorage()
     word_storage.storage = {'word': 1}
     self.assertEqual(word_storage.get_id_of(123), -1)
Exemple #7
0
 def test_word_storage_get_id_of_none(self):
     """get_id_of none"""
     word_storage = WordStorage()
     word_storage.storage = {'word': 1}
     self.assertEqual(word_storage.get_id_of(None), -1)
Exemple #8
0
 def test_word_storage_get_id_of_ideal(self):
     """ideal case for get_id_of"""
     word_storage = WordStorage()
     word_storage.storage = {'word': 1}
     self.assertEqual(word_storage.get_id_of('word'), 1)