~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_help.py

  • Committer: Robert Collins
  • Date: 2007-04-20 03:39:54 UTC
  • mto: This revision was merged to the branch mainline in revision 2441.
  • Revision ID: robertc@robertcollins.net-20070420033954-afes0jishuy9cf6k
Modify the result of HelpIndices.search to include the index each result was found in.

Show diffs side-by-side

added added

removed removed

Lines of Context:
187
187
            ],
188
188
            calls)
189
189
 
190
 
    def test_search_returns_index_results(self):
191
 
        """Searching should return all the help topics found."""
 
190
    def test_search_returns_index_and_results(self):
 
191
        """Searching should return help topics with their index"""
192
192
        class CannedIndex(object):
193
193
            def __init__(self, prefix, search_result):
194
194
                self.prefix = prefix
196
196
            def get_topics(self, topic):
197
197
                return self.result
198
198
        index = help.HelpIndices()
199
 
        index.search_path = [CannedIndex('1', ['a']), CannedIndex('2', ['b', 'c'])]
200
 
        self.assertEqual(['a', 'b', 'c'], index.search(None))
 
199
        index_one = CannedIndex('1', ['a'])
 
200
        index_two = CannedIndex('2', ['b', 'c'])
 
201
        index.search_path = [index_one, index_two]
 
202
        self.assertEqual([(index_one, 'a'), (index_two, 'b'), (index_two, 'c')],
 
203
            index.search(None))
201
204
 
202
205
    def test_search_checks_for_duplicate_prefixes(self):
203
206
        """Its an error when there are multiple indices with the same prefix."""