114
114
'Usage: bzr Demo\n'
117
' --usage Show usage message and options.\n'
117
118
' -v, --verbose Display more information.\n'
118
119
' -q, --quiet Only display errors and warnings.\n'
119
120
' -h, --help Show help message.\n'
133
134
':Usage: bzr Demo\n'
137
' --usage Show usage message and options.\n'
136
138
' -v, --verbose Display more information.\n'
137
139
' -q, --quiet Only display errors and warnings.\n'
138
140
' -h, --help Show help message.\n'
152
def test_concise_help_text(self):
153
"""Concise help text excludes the descriptive sections."""
154
class cmd_Demo(commands.Command):
165
helptext = cmd.get_help_text()
166
self.assertEqualDiff(
168
'Purpose: A sample command.\n'
172
' --usage Show usage message and options.\n'
173
' -v, --verbose Display more information.\n'
174
' -q, --quiet Only display errors and warnings.\n'
175
' -h, --help Show help message.\n'
185
helptext = cmd.get_help_text(verbose=False)
186
self.assertEquals(helptext,
187
'Purpose: A sample command.\n'
191
' --usage Show usage message and options.\n'
192
' -v, --verbose Display more information.\n'
193
' -q, --quiet Only display errors and warnings.\n'
194
' -h, --help Show help message.\n'
196
'See bzr help Demo for more details and examples.\n'
199
def test_help_custom_section_ordering(self):
200
"""Custom descriptive sections should remain in the order given."""
201
class cmd_Demo(commands.Command):
207
Interesting stuff about formats.
215
Clever things to keep in mind.
218
helptext = cmd.get_help_text()
219
self.assertEqualDiff(
221
'Purpose: A sample command.\n'
225
' --usage Show usage message and options.\n'
226
' -v, --verbose Display more information.\n'
227
' -q, --quiet Only display errors and warnings.\n'
228
' -h, --help Show help message.\n'
234
' Interesting stuff about formats.\n'
242
' Clever things to keep in mind.\n'
150
245
def test_help_text_custom_usage(self):
151
246
"""Help text may contain a custom usage section."""
152
247
class cmd_Demo(commands.Command):
268
' --usage Show usage message and options.\n'
173
269
' -v, --verbose Display more information.\n'
174
270
' -q, --quiet Only display errors and warnings.\n'
175
271
' -h, --help Show help message.\n'