Exemplo n.º 1
0
 def test_cache_is_not_used_when_current_search_is_not_subset_of_previous(self):
     mock_source = self._create_mock_source()
     suggestions = Suggestions(mock_source)
     self.assertEquals(mock_source.request_count, 0)
     suggestions.get_for('aa')
     self.assertEquals(mock_source.request_count, 1)
     suggestions.get_for('a')
     self.assertEquals(mock_source.request_count, 2)
Exemplo n.º 2
0
 def test_suggestions_are_cached(self):
     mock_source = self._create_mock_source()
     suggestions = Suggestions(mock_source)
     self.assertEquals(mock_source.request_count, 0)
     suggestions.get_for('a')
     self.assertEquals(mock_source.request_count, 1)
     suggestions.get_for('aa')
     self.assertEquals(mock_source.request_count, 1)
Exemplo n.º 3
0
 def test_suggestions_are_cached(self):
     mock_source = self._create_mock_source()
     suggestions = Suggestions(mock_source)
     self.assertEqual(mock_source.request_count, 0)
     suggestions.get_for('a')
     self.assertEqual(mock_source.request_count, 1)
     suggestions.get_for('aa')
     self.assertEqual(mock_source.request_count, 1)
Exemplo n.º 4
0
 def test_cache_is_not_used_when_current_search_is_not_subset_of_previous(
         self):
     mock_source = self._create_mock_source()
     suggestions = Suggestions(mock_source)
     self.assertEqual(mock_source.request_count, 0)
     suggestions.get_for('aa')
     self.assertEqual(mock_source.request_count, 1)
     suggestions.get_for('a')
     self.assertEqual(mock_source.request_count, 2)
Exemplo n.º 5
0
 def test_suggestions_for_duplicates(self):
     mock_source = self._create_mock_source()
     suggestions = Suggestions(mock_source)
     choices = suggestions.get_for('a')
     self.assertEquals(choices, ['aarnio', 'fo.aaatio', 'bA.AAATIO'])
Exemplo n.º 6
0
 def test_suggestions_for_duplicates(self):
     mock_source = self._create_mock_source()
     suggestions = Suggestions(mock_source)
     choices = suggestions.get_for('a')
     self.assertEqual(choices, ['aarnio', 'fo.aaatio', 'bA.AAATIO'])