~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_help.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil, Patch Queue Manager, Jelmer Vernooij
  • Date: 2017-01-17 16:20:41 UTC
  • mfrom: (6619.1.2 trunk)
  • Revision ID: tarmac-20170117162041-oo62uk1qsmgc9j31
Merge 2.7 into trunk including fixes for bugs #1622039, #1644003, #1579093 and #1645017. [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007-2012, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
16
16
 
17
17
"""Unit tests for the bzrlib.help module."""
18
18
 
19
 
from cStringIO import StringIO
 
19
import textwrap
20
20
 
21
21
from bzrlib import (
22
22
    builtins,
23
23
    commands,
 
24
    config,
24
25
    errors,
25
26
    help,
26
27
    help_topics,
 
28
    i18n,
27
29
    plugin,
28
30
    tests,
29
31
    )
30
32
 
31
 
 
32
 
class TestHelp(tests.TestCase):
33
 
 
34
 
    def setUp(self):
35
 
        tests.TestCase.setUp(self)
36
 
        commands.install_bzr_command_hooks()
 
33
from bzrlib.tests.test_i18n import ZzzTranslations
 
34
import re
37
35
 
38
36
 
39
37
class TestCommandHelp(tests.TestCase):
40
38
    """Tests for help on commands."""
41
39
 
 
40
    def assertCmdHelp(self, expected, cmd):
 
41
        self.assertEqualDiff(textwrap.dedent(expected), cmd.get_help_text())
 
42
 
42
43
    def test_command_help_includes_see_also(self):
43
44
        class cmd_WithSeeAlso(commands.Command):
44
45
            __doc__ = """A sample command."""
45
46
            _see_also = ['foo', 'bar']
46
 
        cmd = cmd_WithSeeAlso()
47
 
        helptext = cmd.get_help_text()
48
 
        self.assertEndsWith(
49
 
            helptext,
50
 
            '  -v, --verbose  Display more information.\n'
51
 
            '  -q, --quiet    Only display errors and warnings.\n'
52
 
            '  -h, --help     Show help message.\n'
53
 
            '\n'
54
 
            'See also: bar, foo\n')
 
47
        self.assertCmdHelp('''\
 
48
Purpose: A sample command.
 
49
Usage:   bzr WithSeeAlso
 
50
 
 
51
Options:
 
52
  --usage        Show usage message and options.
 
53
  -q, --quiet    Only display errors and warnings.
 
54
  -v, --verbose  Display more information.
 
55
  -h, --help     Show help message.
 
56
 
 
57
See also: bar, foo
 
58
''',
 
59
                           cmd_WithSeeAlso())
55
60
 
56
61
    def test_get_help_text(self):
57
62
        """Commands have a get_help_text method which returns their help."""
58
63
        class cmd_Demo(commands.Command):
59
64
            __doc__ = """A sample command."""
 
65
        self.assertCmdHelp('''\
 
66
Purpose: A sample command.
 
67
Usage:   bzr Demo
 
68
 
 
69
Options:
 
70
  --usage        Show usage message and options.
 
71
  -q, --quiet    Only display errors and warnings.
 
72
  -v, --verbose  Display more information.
 
73
  -h, --help     Show help message.
 
74
 
 
75
''',
 
76
                           cmd_Demo())
60
77
        cmd = cmd_Demo()
61
78
        helptext = cmd.get_help_text()
62
79
        self.assertStartsWith(helptext,
73
90
        helptext = cmd.get_help_text(['gam'])
74
91
        self.assertEndsWith(
75
92
            helptext,
 
93
            '  -q, --quiet    Only display errors and warnings.\n'
76
94
            '  -v, --verbose  Display more information.\n'
77
 
            '  -q, --quiet    Only display errors and warnings.\n'
78
95
            '  -h, --help     Show help message.\n'
79
96
            '\n'
80
97
            'See also: bar, foo, gam\n')
86
103
        helptext = cmd.get_help_text(['gam'])
87
104
        self.assertEndsWith(
88
105
            helptext,
 
106
            '  -q, --quiet    Only display errors and warnings.\n'
89
107
            '  -v, --verbose  Display more information.\n'
90
 
            '  -q, --quiet    Only display errors and warnings.\n'
91
108
            '  -h, --help     Show help message.\n'
92
109
            '\n'
93
110
            'See also: gam\n')
121
138
            """
122
139
        cmd = cmd_Demo()
123
140
        helptext = cmd.get_help_text()
124
 
        self.assertEquals(
125
 
            helptext,
126
 
            'Purpose: A sample command.\n'
127
 
            'Usage:   bzr Demo\n'
128
 
            '\n'
129
 
            'Options:\n'
130
 
            '  --usage        Show usage message and options.\n'
131
 
            '  -v, --verbose  Display more information.\n'
132
 
            '  -q, --quiet    Only display errors and warnings.\n'
133
 
            '  -h, --help     Show help message.\n'
134
 
            '\n'
135
 
            'Examples:\n'
136
 
            '    Example 1:\n'
137
 
            '\n'
138
 
            '        cmd arg1\n'
139
 
            '\n'
140
 
            '    Example 2:\n'
141
 
            '\n'
142
 
            '        cmd arg2\n'
143
 
            '\n'
144
 
            '    A code block follows.\n'
145
 
            '\n'
146
 
            '        bzr Demo something\n'
147
 
            '\n')
 
141
        self.assertEqualDiff('''\
 
142
Purpose: A sample command.
 
143
Usage:   bzr Demo
 
144
 
 
145
Options:
 
146
  --usage        Show usage message and options.
 
147
  -q, --quiet    Only display errors and warnings.
 
148
  -v, --verbose  Display more information.
 
149
  -h, --help     Show help message.
 
150
 
 
151
Examples:
 
152
    Example 1:
 
153
 
 
154
        cmd arg1
 
155
 
 
156
    Example 2:
 
157
 
 
158
        cmd arg2
 
159
 
 
160
    A code block follows.
 
161
 
 
162
        bzr Demo something
 
163
 
 
164
''',
 
165
                                         helptext)
148
166
        helptext = cmd.get_help_text(plain=False)
149
 
        self.assertEquals(helptext,
150
 
            ':Purpose: A sample command.\n'
151
 
            ':Usage:   bzr Demo\n'
152
 
            '\n'
153
 
            ':Options:\n'
154
 
            '  --usage        Show usage message and options.\n'
155
 
            '  -v, --verbose  Display more information.\n'
156
 
            '  -q, --quiet    Only display errors and warnings.\n'
157
 
            '  -h, --help     Show help message.\n'
158
 
            '\n'
159
 
            ':Examples:\n'
160
 
            '    Example 1::\n'
161
 
            '\n'
162
 
            '        cmd arg1\n'
163
 
            '\n'
164
 
            '    Example 2::\n'
165
 
            '\n'
166
 
            '        cmd arg2\n'
167
 
            '\n'
168
 
            '    A code block follows.\n'
169
 
            '\n'
170
 
            '    ::\n'
171
 
            '\n'
172
 
            '        bzr Demo something\n'
173
 
            '\n')
 
167
        self.assertEqualDiff('''\
 
168
:Purpose: A sample command.
 
169
:Usage:   bzr Demo
 
170
 
 
171
:Options:
 
172
  --usage        Show usage message and options.
 
173
  -q, --quiet    Only display errors and warnings.
 
174
  -v, --verbose  Display more information.
 
175
  -h, --help     Show help message.
 
176
 
 
177
:Examples:
 
178
    Example 1::
 
179
 
 
180
        cmd arg1
 
181
 
 
182
    Example 2::
 
183
 
 
184
        cmd arg2
 
185
 
 
186
    A code block follows.
 
187
 
 
188
    ::
 
189
 
 
190
        bzr Demo something
 
191
 
 
192
''',
 
193
                             helptext)
174
194
 
175
195
    def test_concise_help_text(self):
176
196
        """Concise help text excludes the descriptive sections."""
186
206
            """
187
207
        cmd = cmd_Demo()
188
208
        helptext = cmd.get_help_text()
189
 
        self.assertEqualDiff(
190
 
            helptext,
191
 
            'Purpose: A sample command.\n'
192
 
            'Usage:   bzr Demo\n'
193
 
            '\n'
194
 
            'Options:\n'
195
 
            '  --usage        Show usage message and options.\n'
196
 
            '  -v, --verbose  Display more information.\n'
197
 
            '  -q, --quiet    Only display errors and warnings.\n'
198
 
            '  -h, --help     Show help message.\n'
199
 
            '\n'
200
 
            'Description:\n'
201
 
            '  Blah blah blah.\n'
202
 
            '\n'
203
 
            'Examples:\n'
204
 
            '    Example 1:\n'
205
 
            '\n'
206
 
            '        cmd arg1\n'
207
 
            '\n')
 
209
        self.assertEqualDiff('''\
 
210
Purpose: A sample command.
 
211
Usage:   bzr Demo
 
212
 
 
213
Options:
 
214
  --usage        Show usage message and options.
 
215
  -q, --quiet    Only display errors and warnings.
 
216
  -v, --verbose  Display more information.
 
217
  -h, --help     Show help message.
 
218
 
 
219
Description:
 
220
  Blah blah blah.
 
221
 
 
222
Examples:
 
223
    Example 1:
 
224
 
 
225
        cmd arg1
 
226
 
 
227
''',
 
228
                             helptext)
208
229
        helptext = cmd.get_help_text(verbose=False)
209
 
        self.assertEquals(helptext,
210
 
            'Purpose: A sample command.\n'
211
 
            'Usage:   bzr Demo\n'
212
 
            '\n'
213
 
            'Options:\n'
214
 
            '  --usage        Show usage message and options.\n'
215
 
            '  -v, --verbose  Display more information.\n'
216
 
            '  -q, --quiet    Only display errors and warnings.\n'
217
 
            '  -h, --help     Show help message.\n'
218
 
            '\n'
219
 
            'See bzr help Demo for more details and examples.\n'
220
 
            '\n')
221
 
 
222
 
    def test_help_custom_section_ordering(self):
223
 
        """Custom descriptive sections should remain in the order given."""
 
230
        self.assertEqualDiff('''\
 
231
Purpose: A sample command.
 
232
Usage:   bzr Demo
 
233
 
 
234
Options:
 
235
  --usage        Show usage message and options.
 
236
  -q, --quiet    Only display errors and warnings.
 
237
  -v, --verbose  Display more information.
 
238
  -h, --help     Show help message.
 
239
 
 
240
See bzr help Demo for more details and examples.
 
241
 
 
242
''',
 
243
                             helptext)
 
244
 
 
245
    def test_help_custom_section_ordering(self):
 
246
        """Custom descriptive sections should remain in the order given."""
 
247
        class cmd_Demo(commands.Command):
 
248
            __doc__ = """\
 
249
A sample command.
 
250
 
 
251
Blah blah blah.
 
252
 
 
253
:Formats:
 
254
  Interesting stuff about formats.
 
255
 
 
256
:Examples:
 
257
  Example 1::
 
258
 
 
259
    cmd arg1
 
260
 
 
261
:Tips:
 
262
  Clever things to keep in mind.
 
263
"""
 
264
        cmd = cmd_Demo()
 
265
        helptext = cmd.get_help_text()
 
266
        self.assertEqualDiff('''\
 
267
Purpose: A sample command.
 
268
Usage:   bzr Demo
 
269
 
 
270
Options:
 
271
  --usage        Show usage message and options.
 
272
  -q, --quiet    Only display errors and warnings.
 
273
  -v, --verbose  Display more information.
 
274
  -h, --help     Show help message.
 
275
 
 
276
Description:
 
277
  Blah blah blah.
 
278
 
 
279
Formats:
 
280
  Interesting stuff about formats.
 
281
 
 
282
Examples:
 
283
  Example 1:
 
284
 
 
285
    cmd arg1
 
286
 
 
287
Tips:
 
288
  Clever things to keep in mind.
 
289
 
 
290
''',
 
291
                             helptext)
 
292
 
 
293
    def test_help_text_custom_usage(self):
 
294
        """Help text may contain a custom usage section."""
 
295
        class cmd_Demo(commands.Command):
 
296
            __doc__ = """A sample command.
 
297
 
 
298
            :Usage:
 
299
                cmd Demo [opts] args
 
300
 
 
301
                cmd Demo -h
 
302
 
 
303
            Blah blah blah.
 
304
            """
 
305
        cmd = cmd_Demo()
 
306
        helptext = cmd.get_help_text()
 
307
        self.assertEqualDiff('''\
 
308
Purpose: A sample command.
 
309
Usage:
 
310
    cmd Demo [opts] args
 
311
 
 
312
    cmd Demo -h
 
313
 
 
314
 
 
315
Options:
 
316
  --usage        Show usage message and options.
 
317
  -q, --quiet    Only display errors and warnings.
 
318
  -v, --verbose  Display more information.
 
319
  -h, --help     Show help message.
 
320
 
 
321
Description:
 
322
  Blah blah blah.
 
323
 
 
324
''',
 
325
                             helptext)
 
326
 
 
327
 
 
328
class ZzzTranslationsForDoc(ZzzTranslations):
 
329
 
 
330
    _section_pat = re.compile(':\w+:\\n\\s+')
 
331
    _indent_pat = re.compile('\\s+')
 
332
 
 
333
    def zzz(self, s):
 
334
        m = self._section_pat.match(s)
 
335
        if m is None:
 
336
            m = self._indent_pat.match(s)
 
337
        if m:
 
338
            return u'%szz{{%s}}' % (m.group(0), s[m.end():])
 
339
        return u'zz{{%s}}' % s
 
340
 
 
341
 
 
342
class TestCommandHelpI18n(tests.TestCase):
 
343
    """Tests for help on translated commands."""
 
344
 
 
345
    def setUp(self):
 
346
        super(TestCommandHelpI18n, self).setUp()
 
347
        self.overrideAttr(i18n, '_translations', ZzzTranslationsForDoc())
 
348
 
 
349
    def assertCmdHelp(self, expected, cmd):
 
350
        self.assertEqualDiff(textwrap.dedent(expected), cmd.get_help_text())
 
351
 
 
352
    def test_command_help_includes_see_also(self):
 
353
        class cmd_WithSeeAlso(commands.Command):
 
354
            __doc__ = """A sample command."""
 
355
            _see_also = ['foo', 'bar']
 
356
        self.assertCmdHelp('''\
 
357
zz{{:Purpose: zz{{A sample command.}}
 
358
}}zz{{:Usage:   bzr WithSeeAlso
 
359
}}
 
360
zz{{:Options:
 
361
  --usage        zz{{Show usage message and options.}}
 
362
  -q, --quiet    zz{{Only display errors and warnings.}}
 
363
  -v, --verbose  zz{{Display more information.}}
 
364
  -h, --help     zz{{Show help message.}}
 
365
}}
 
366
zz{{:See also: bar, foo}}
 
367
''',
 
368
                           cmd_WithSeeAlso())
 
369
 
 
370
    def test_get_help_text(self):
 
371
        """Commands have a get_help_text method which returns their help."""
 
372
        class cmd_Demo(commands.Command):
 
373
            __doc__ = """A sample command."""
 
374
        self.assertCmdHelp('''\
 
375
zz{{:Purpose: zz{{A sample command.}}
 
376
}}zz{{:Usage:   bzr Demo
 
377
}}
 
378
zz{{:Options:
 
379
  --usage        zz{{Show usage message and options.}}
 
380
  -q, --quiet    zz{{Only display errors and warnings.}}
 
381
  -v, --verbose  zz{{Display more information.}}
 
382
  -h, --help     zz{{Show help message.}}
 
383
}}
 
384
''',
 
385
                           cmd_Demo())
 
386
 
 
387
    def test_command_with_additional_see_also(self):
 
388
        class cmd_WithSeeAlso(commands.Command):
 
389
            __doc__ = """A sample command."""
 
390
            _see_also = ['foo', 'bar']
 
391
        cmd = cmd_WithSeeAlso()
 
392
        helptext = cmd.get_help_text(['gam'])
 
393
        self.assertEndsWith(
 
394
            helptext,'''\
 
395
  -q, --quiet    zz{{Only display errors and warnings.}}
 
396
  -v, --verbose  zz{{Display more information.}}
 
397
  -h, --help     zz{{Show help message.}}
 
398
}}
 
399
zz{{:See also: bar, foo, gam}}
 
400
''')
 
401
 
 
402
    def test_command_only_additional_see_also(self):
 
403
        class cmd_WithSeeAlso(commands.Command):
 
404
            __doc__ = """A sample command."""
 
405
        cmd = cmd_WithSeeAlso()
 
406
        helptext = cmd.get_help_text(['gam'])
 
407
        self.assertEndsWith(
 
408
            helptext, '''\
 
409
zz{{:Options:
 
410
  --usage        zz{{Show usage message and options.}}
 
411
  -q, --quiet    zz{{Only display errors and warnings.}}
 
412
  -v, --verbose  zz{{Display more information.}}
 
413
  -h, --help     zz{{Show help message.}}
 
414
}}
 
415
zz{{:See also: gam}}
 
416
''')
 
417
 
 
418
 
 
419
    def test_help_custom_section_ordering(self):
 
420
        """Custom descriptive sections should remain in the order given."""
 
421
        # The help formatter expect the class name to start with 'cmd_'
224
422
        class cmd_Demo(commands.Command):
225
423
            __doc__ = """A sample command.
226
424
 
237
435
            :Tips:
238
436
              Clever things to keep in mind.
239
437
            """
240
 
        cmd = cmd_Demo()
241
 
        helptext = cmd.get_help_text()
242
 
        self.assertEqualDiff(
243
 
            helptext,
244
 
            'Purpose: A sample command.\n'
245
 
            'Usage:   bzr Demo\n'
246
 
            '\n'
247
 
            'Options:\n'
248
 
            '  --usage        Show usage message and options.\n'
249
 
            '  -v, --verbose  Display more information.\n'
250
 
            '  -q, --quiet    Only display errors and warnings.\n'
251
 
            '  -h, --help     Show help message.\n'
252
 
            '\n'
253
 
            'Description:\n'
254
 
            '  Blah blah blah.\n'
255
 
            '\n'
256
 
            'Formats:\n'
257
 
            '  Interesting stuff about formats.\n'
258
 
            '\n'
259
 
            'Examples:\n'
260
 
            '  Example 1:\n'
261
 
            '\n'
262
 
            '    cmd arg1\n'
263
 
            '\n'
264
 
            'Tips:\n'
265
 
            '  Clever things to keep in mind.\n'
266
 
            '\n')
 
438
        self.assertCmdHelp('''\
 
439
zz{{:Purpose: zz{{A sample command.}}
 
440
}}zz{{:Usage:   bzr Demo
 
441
}}
 
442
zz{{:Options:
 
443
  --usage        zz{{Show usage message and options.}}
 
444
  -q, --quiet    zz{{Only display errors and warnings.}}
 
445
  -v, --verbose  zz{{Display more information.}}
 
446
  -h, --help     zz{{Show help message.}}
 
447
}}
 
448
Description:
 
449
  zz{{zz{{Blah blah blah.}}
 
450
 
 
451
}}:Formats:
 
452
  zz{{Interesting stuff about formats.}}
 
453
 
 
454
Examples:
 
455
  zz{{Example 1::}}
 
456
 
 
457
    zz{{cmd arg1}}
 
458
 
 
459
Tips:
 
460
  zz{{Clever things to keep in mind.}}
 
461
 
 
462
''',
 
463
                           cmd_Demo())
267
464
 
268
465
    def test_help_text_custom_usage(self):
269
466
        """Help text may contain a custom usage section."""
277
474
 
278
475
            Blah blah blah.
279
476
            """
280
 
        cmd = cmd_Demo()
281
 
        helptext = cmd.get_help_text()
282
 
        self.assertEquals(helptext,
283
 
            'Purpose: A sample command.\n'
284
 
            'Usage:\n'
285
 
            '    cmd Demo [opts] args\n'
286
 
            '\n'
287
 
            '    cmd Demo -h\n'
288
 
            '\n'
289
 
            '\n'
290
 
            'Options:\n'
291
 
            '  --usage        Show usage message and options.\n'
292
 
            '  -v, --verbose  Display more information.\n'
293
 
            '  -q, --quiet    Only display errors and warnings.\n'
294
 
            '  -h, --help     Show help message.\n'
295
 
            '\n'
296
 
            'Description:\n'
297
 
            '  Blah blah blah.\n\n')
 
477
        self.assertCmdHelp('''\
 
478
zz{{:Purpose: zz{{A sample command.}}
 
479
}}zz{{:Usage:
 
480
    zz{{cmd Demo [opts] args}}
 
481
 
 
482
    zz{{cmd Demo -h}}
 
483
 
 
484
}}
 
485
zz{{:Options:
 
486
  --usage        zz{{Show usage message and options.}}
 
487
  -q, --quiet    zz{{Only display errors and warnings.}}
 
488
  -v, --verbose  zz{{Display more information.}}
 
489
  -h, --help     zz{{Show help message.}}
 
490
}}
 
491
Description:
 
492
  zz{{zz{{Blah blah blah.}}
 
493
 
 
494
}}
 
495
''',
 
496
                           cmd_Demo())
 
497
 
 
498
 
 
499
class TestHelp(tests.TestCase):
 
500
 
 
501
    def setUp(self):
 
502
        super(TestHelp, self).setUp()
 
503
        commands.install_bzr_command_hooks()
298
504
 
299
505
 
300
506
class TestRegisteredTopic(TestHelp):
308
514
        self.assertEqual('basic', topic.topic)
309
515
 
310
516
    def test_get_help_text(self):
311
 
        """A RegisteredTopic returns the get_detail results for get_help_text."""
 
517
        """RegisteredTopic returns the get_detail results for get_help_text."""
312
518
        topic = help_topics.RegisteredTopic('commands')
313
519
        self.assertEqual(help_topics.topic_registry.get_detail('commands'),
314
 
            topic.get_help_text())
 
520
                         topic.get_help_text())
315
521
 
316
522
    def test_get_help_text_with_additional_see_also(self):
317
523
        topic = help_topics.RegisteredTopic('commands')
329
535
            '\n')
330
536
 
331
537
    def test_get_help_topic(self):
332
 
        """The help topic for a RegisteredTopic is its topic from construction."""
 
538
        """The help topic for RegisteredTopic is its topic from construction."""
333
539
        topic = help_topics.RegisteredTopic('foobar')
334
540
        self.assertEqual('foobar', topic.get_help_topic())
335
541
        topic = help_topics.RegisteredTopic('baz')
369
575
        self.assertEqual('', index.prefix)
370
576
 
371
577
 
 
578
class TestConfigOptionIndex(TestHelp):
 
579
    """Tests for the HelpCommandIndex class."""
 
580
 
 
581
    def setUp(self):
 
582
        super(TestConfigOptionIndex, self).setUp()
 
583
        self.index = help_topics.ConfigOptionHelpIndex()
 
584
 
 
585
    def test_get_topics_None(self):
 
586
        """Searching for None returns an empty list."""
 
587
        self.assertEqual([], self.index.get_topics(None))
 
588
 
 
589
    def test_get_topics_no_topic(self):
 
590
        self.assertEqual([], self.index.get_topics('nothing by this name'))
 
591
 
 
592
    def test_prefix(self):
 
593
        self.assertEqual('configuration/', self.index.prefix)
 
594
 
 
595
    def test_get_topic_with_prefix(self):
 
596
        topics = self.index.get_topics('configuration/default_format')
 
597
        self.assertLength(1, topics)
 
598
        opt = topics[0]
 
599
        self.assertIsInstance(opt, config.Option)
 
600
        self.assertEqual('default_format', opt.name)
 
601
 
 
602
 
372
603
class TestCommandIndex(TestHelp):
373
604
    """Tests for the HelpCommandIndex class."""
374
605
 
411
642
    def test_default_search_path(self):
412
643
        """The default search path should include internal indexs."""
413
644
        indices = help.HelpIndices()
414
 
        self.assertEqual(3, len(indices.search_path))
 
645
        self.assertEqual(4, len(indices.search_path))
415
646
        # help topics should be searched in first.
416
647
        self.assertIsInstance(indices.search_path[0],
417
 
            help_topics.HelpTopicIndex)
 
648
                              help_topics.HelpTopicIndex)
418
649
        # with commands being search second.
419
650
        self.assertIsInstance(indices.search_path[1],
420
 
            commands.HelpCommandIndex)
421
 
        # and plugins are a third index.
 
651
                              commands.HelpCommandIndex)
 
652
        # plugins are a third index.
422
653
        self.assertIsInstance(indices.search_path[2],
423
 
            plugin.PluginsHelpIndex)
 
654
                              plugin.PluginsHelpIndex)
 
655
        # config options are a fourth index
 
656
        self.assertIsInstance(indices.search_path[3],
 
657
                              help_topics.ConfigOptionHelpIndex)
424
658
 
425
659
    def test_search_for_unknown_topic_raises(self):
426
660
        """Searching for an unknown topic should raise NoHelpTopic."""