/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/tests/test_export_pot.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
from cStringIO import StringIO
 
17
import re
18
18
import textwrap
19
19
 
20
 
from bzrlib import (
 
20
from .. import (
21
21
    commands,
22
22
    export_pot,
23
23
    option,
24
24
    registry,
25
25
    tests,
26
26
    )
27
 
 
28
 
import re
 
27
from ..sixish import (
 
28
    BytesIO,
 
29
    )
29
30
 
30
31
 
31
32
class TestEscape(tests.TestCase):
227
228
    """Tests for writing texts extracted from options in pot format"""
228
229
 
229
230
    def pot_from_option(self, opt, context=None, note="test"):
230
 
        sio = StringIO()
 
231
        sio = BytesIO()
231
232
        exporter = export_pot._PotExporter(sio)
232
233
        if context is None:
233
234
            context = export_pot._ModuleContext("nowhere", 0)
327
328
 
328
329
    # This test duplicates test_duplicates below
329
330
    def test_duplicates(self):
330
 
        exporter = export_pot._PotExporter(StringIO())
 
331
        exporter = export_pot._PotExporter(BytesIO())
331
332
        context = export_pot._ModuleContext("mod.py", 1)
332
333
        exporter.poentry_in_context(context, "Common line.")
333
334
        context.lineno = 3
335
336
        self.assertEqual(1, exporter.outf.getvalue().count("Common line."))
336
337
    
337
338
    def test_duplicates_included(self):
338
 
        exporter = export_pot._PotExporter(StringIO(), True)
 
339
        exporter = export_pot._PotExporter(BytesIO(), True)
339
340
        context = export_pot._ModuleContext("mod.py", 1)
340
341
        exporter.poentry_in_context(context, "Common line.")
341
342
        context.lineno = 3
347
348
 
348
349
    def setUp(self):
349
350
        super(PoEntryTestCase, self).setUp()
350
 
        self.exporter = export_pot._PotExporter(StringIO())
 
351
        self.exporter = export_pot._PotExporter(BytesIO())
351
352
 
352
353
    def check_output(self, expected):
353
354
        self.assertEqual(