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)
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)
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)
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)
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'])
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'])