~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_help.py

  • Committer: John Arbash Meinel
  • Date: 2010-05-11 10:45:26 UTC
  • mto: This revision was merged to the branch mainline in revision 5225.
  • Revision ID: john@arbash-meinel.com-20100511104526-zxnstcxta22hzw2n
Implement a compiled extension for parsing the text key out of a CHKInventory value.

Related to bug #562666. This seems to shave 5-10% out of the time spent doing a complete
branch of bzr.dev/launchpad/etc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2011 Canonical Ltd
 
1
# Copyright (C) 2007-2010 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
 
20
 
19
21
from bzrlib import (
20
22
    builtins,
21
23
    commands,
110
112
                Example 2::
111
113
 
112
114
                    cmd arg2
113
 
 
114
 
                A code block follows.
115
 
 
116
 
                ::
117
 
 
118
 
                    bzr Demo something
119
115
            """
120
116
        cmd = cmd_Demo()
121
117
        helptext = cmd.get_help_text()
126
122
            '\n'
127
123
            'Options:\n'
128
124
            '  --usage        Show usage message and options.\n'
 
125
            '  -0, --null     Use an ASCII NUL (\\0) separator rather than a newline.\n'
129
126
            '  -v, --verbose  Display more information.\n'
130
127
            '  -q, --quiet    Only display errors and warnings.\n'
131
128
            '  -h, --help     Show help message.\n'
138
135
            '    Example 2:\n'
139
136
            '\n'
140
137
            '        cmd arg2\n'
141
 
            '\n'
142
 
            '    A code block follows.\n'
143
 
            '\n'
144
 
            '        bzr Demo something\n'
145
138
            '\n')
146
139
        helptext = cmd.get_help_text(plain=False)
147
140
        self.assertEquals(helptext,
150
143
            '\n'
151
144
            ':Options:\n'
152
145
            '  --usage        Show usage message and options.\n'
 
146
            '  -0, --null     Use an ASCII NUL (\\0) separator rather than a newline.\n'
153
147
            '  -v, --verbose  Display more information.\n'
154
148
            '  -q, --quiet    Only display errors and warnings.\n'
155
149
            '  -h, --help     Show help message.\n'
162
156
            '    Example 2::\n'
163
157
            '\n'
164
158
            '        cmd arg2\n'
165
 
            '\n'
166
 
            '    A code block follows.\n'
167
 
            '\n'
168
 
            '    ::\n'
169
 
            '\n'
170
 
            '        bzr Demo something\n'
171
159
            '\n')
172
160
 
173
161
    def test_concise_help_text(self):
191
179
            '\n'
192
180
            'Options:\n'
193
181
            '  --usage        Show usage message and options.\n'
 
182
            '  -0, --null     Use an ASCII NUL (\\0) separator rather than a newline.\n'
194
183
            '  -v, --verbose  Display more information.\n'
195
184
            '  -q, --quiet    Only display errors and warnings.\n'
196
185
            '  -h, --help     Show help message.\n'
210
199
            '\n'
211
200
            'Options:\n'
212
201
            '  --usage        Show usage message and options.\n'
 
202
            '  -0, --null     Use an ASCII NUL (\\0) separator rather than a newline.\n'
213
203
            '  -v, --verbose  Display more information.\n'
214
204
            '  -q, --quiet    Only display errors and warnings.\n'
215
205
            '  -h, --help     Show help message.\n'
244
234
            '\n'
245
235
            'Options:\n'
246
236
            '  --usage        Show usage message and options.\n'
 
237
            '  -0, --null     Use an ASCII NUL (\\0) separator rather than a newline.\n'
247
238
            '  -v, --verbose  Display more information.\n'
248
239
            '  -q, --quiet    Only display errors and warnings.\n'
249
240
            '  -h, --help     Show help message.\n'
287
278
            '\n'
288
279
            'Options:\n'
289
280
            '  --usage        Show usage message and options.\n'
 
281
            '  -0, --null     Use an ASCII NUL (\\0) separator rather than a newline.\n'
290
282
            '  -v, --verbose  Display more information.\n'
291
283
            '  -q, --quiet    Only display errors and warnings.\n'
292
284
            '  -h, --help     Show help message.\n'