/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_help.py

  • Committer: Martin Pool
  • Date: 2010-02-23 02:32:52 UTC
  • mto: This revision was merged to the branch mainline in revision 5054.
  • Revision ID: mbp@sourcefrog.net-20100223023252-zk4ds0sbeuga82et
Clarify Launchpad setup example

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007 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
41
41
 
42
42
    def test_command_help_includes_see_also(self):
43
43
        class cmd_WithSeeAlso(commands.Command):
44
 
            __doc__ = """A sample command."""
 
44
            """A sample command."""
45
45
            _see_also = ['foo', 'bar']
46
46
        cmd = cmd_WithSeeAlso()
47
47
        helptext = cmd.get_help_text()
56
56
    def test_get_help_text(self):
57
57
        """Commands have a get_help_text method which returns their help."""
58
58
        class cmd_Demo(commands.Command):
59
 
            __doc__ = """A sample command."""
 
59
            """A sample command."""
60
60
        cmd = cmd_Demo()
61
61
        helptext = cmd.get_help_text()
62
62
        self.assertStartsWith(helptext,
67
67
 
68
68
    def test_command_with_additional_see_also(self):
69
69
        class cmd_WithSeeAlso(commands.Command):
70
 
            __doc__ = """A sample command."""
 
70
            """A sample command."""
71
71
            _see_also = ['foo', 'bar']
72
72
        cmd = cmd_WithSeeAlso()
73
73
        helptext = cmd.get_help_text(['gam'])
81
81
 
82
82
    def test_command_only_additional_see_also(self):
83
83
        class cmd_WithSeeAlso(commands.Command):
84
 
            __doc__ = """A sample command."""
 
84
            """A sample command."""
85
85
        cmd = cmd_WithSeeAlso()
86
86
        helptext = cmd.get_help_text(['gam'])
87
87
        self.assertEndsWith(
95
95
    def test_get_help_topic(self):
96
96
        """The help topic for a Command is its name()."""
97
97
        class cmd_foo_bar(commands.Command):
98
 
            __doc__ = """A sample command."""
 
98
            """A sample command."""
99
99
        cmd = cmd_foo_bar()
100
100
        self.assertEqual(cmd.name(), cmd.get_help_topic())
101
101
 
102
102
    def test_formatted_help_text(self):
103
103
        """Help text should be plain text by default."""
104
104
        class cmd_Demo(commands.Command):
105
 
            __doc__ = """A sample command.
 
105
            """A sample command.
106
106
 
107
107
            :Examples:
108
108
                Example 1::
122
122
            '\n'
123
123
            'Options:\n'
124
124
            '  --usage        Show usage message and options.\n'
125
 
            '  -0, --null     Use an ASCII NUL (\\0) separator rather than a newline.\n'
126
125
            '  -v, --verbose  Display more information.\n'
127
126
            '  -q, --quiet    Only display errors and warnings.\n'
128
127
            '  -h, --help     Show help message.\n'
143
142
            '\n'
144
143
            ':Options:\n'
145
144
            '  --usage        Show usage message and options.\n'
146
 
            '  -0, --null     Use an ASCII NUL (\\0) separator rather than a newline.\n'
147
145
            '  -v, --verbose  Display more information.\n'
148
146
            '  -q, --quiet    Only display errors and warnings.\n'
149
147
            '  -h, --help     Show help message.\n'
161
159
    def test_concise_help_text(self):
162
160
        """Concise help text excludes the descriptive sections."""
163
161
        class cmd_Demo(commands.Command):
164
 
            __doc__ = """A sample command.
 
162
            """A sample command.
165
163
 
166
164
            Blah blah blah.
167
165
 
179
177
            '\n'
180
178
            'Options:\n'
181
179
            '  --usage        Show usage message and options.\n'
182
 
            '  -0, --null     Use an ASCII NUL (\\0) separator rather than a newline.\n'
183
180
            '  -v, --verbose  Display more information.\n'
184
181
            '  -q, --quiet    Only display errors and warnings.\n'
185
182
            '  -h, --help     Show help message.\n'
199
196
            '\n'
200
197
            'Options:\n'
201
198
            '  --usage        Show usage message and options.\n'
202
 
            '  -0, --null     Use an ASCII NUL (\\0) separator rather than a newline.\n'
203
199
            '  -v, --verbose  Display more information.\n'
204
200
            '  -q, --quiet    Only display errors and warnings.\n'
205
201
            '  -h, --help     Show help message.\n'
210
206
    def test_help_custom_section_ordering(self):
211
207
        """Custom descriptive sections should remain in the order given."""
212
208
        class cmd_Demo(commands.Command):
213
 
            __doc__ = """A sample command.
 
209
            """A sample command.
214
210
 
215
211
            Blah blah blah.
216
212
 
234
230
            '\n'
235
231
            'Options:\n'
236
232
            '  --usage        Show usage message and options.\n'
237
 
            '  -0, --null     Use an ASCII NUL (\\0) separator rather than a newline.\n'
238
233
            '  -v, --verbose  Display more information.\n'
239
234
            '  -q, --quiet    Only display errors and warnings.\n'
240
235
            '  -h, --help     Show help message.\n'
257
252
    def test_help_text_custom_usage(self):
258
253
        """Help text may contain a custom usage section."""
259
254
        class cmd_Demo(commands.Command):
260
 
            __doc__ = """A sample command.
 
255
            """A sample command.
261
256
 
262
257
            :Usage:
263
258
                cmd Demo [opts] args
278
273
            '\n'
279
274
            'Options:\n'
280
275
            '  --usage        Show usage message and options.\n'
281
 
            '  -0, --null     Use an ASCII NUL (\\0) separator rather than a newline.\n'
282
276
            '  -v, --verbose  Display more information.\n'
283
277
            '  -q, --quiet    Only display errors and warnings.\n'
284
278
            '  -h, --help     Show help message.\n'