~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_export_pot.py

Move all features to bzrlib.tests.features in 2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import textwrap
19
19
 
20
20
from bzrlib import (
 
21
    commands,
21
22
    export_pot,
22
23
    tests,
23
24
    )
24
25
 
 
26
import re
 
27
 
 
28
 
25
29
class TestEscape(tests.TestCase):
26
30
 
27
31
    def test_simple_escape(self):
145
149
                "EGG\\n"
146
150
                msgstr ""\n
147
151
                ''')
 
152
 
 
153
 
 
154
class TestExportCommandHelp(PoEntryTestCase):
 
155
 
 
156
    def test_command_help(self):
 
157
 
 
158
        class cmd_Demo(commands.Command):
 
159
            __doc__ = """A sample command.
 
160
 
 
161
            :Usage:
 
162
                bzr demo
 
163
 
 
164
            :Examples:
 
165
                Example 1::
 
166
 
 
167
                    cmd arg1
 
168
 
 
169
            Blah Blah Blah
 
170
            """
 
171
 
 
172
        export_pot._write_command_help(self._outf, cmd_Demo())
 
173
        result = self._outf.getvalue()
 
174
        # We don't care about filename and lineno here.
 
175
        result = re.sub(r'(?m)^#: [^\n]+\n', '', result)
 
176
 
 
177
        self.assertEqualDiff(
 
178
                'msgid "A sample command."\n'
 
179
                'msgstr ""\n'
 
180
                '\n'                # :Usage: should not be translated.
 
181
                'msgid ""\n'
 
182
                '":Examples:\\n"\n'
 
183
                '"    Example 1::"\n'
 
184
                'msgstr ""\n'
 
185
                '\n'
 
186
                'msgid "        cmd arg1"\n'
 
187
                'msgstr ""\n'
 
188
                '\n'
 
189
                'msgid "Blah Blah Blah"\n'
 
190
                'msgstr ""\n'
 
191
                '\n',
 
192
                result
 
193
                )