15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
from cStringIO import StringIO
19
20
from bzrlib import (
62
63
self.assertEqual(export_pot._normalize(s), e)
65
class TestPoEntry(tests.TestCase):
66
class PoEntryTestCase(tests.TestCase):
68
69
self.overrideAttr(export_pot, '_FOUND_MSGID', set())
69
70
self._outf = StringIO()
70
super(TestPoEntry, self).setUp()
71
super(PoEntryTestCase, self).setUp()
73
def check_output(self, expected):
75
self._outf.getvalue(),
76
textwrap.dedent(expected)
79
class TestPoEntry(PoEntryTestCase):
72
81
def test_simple(self):
73
export_pot._poentry( self._outf, 'dummy', 1, "spam")
74
export_pot._poentry( self._outf, 'dummy', 2, "ham", 'EGG')
76
self._outf.getvalue(),
82
export_pot._poentry(self._outf, 'dummy', 1, "spam")
83
export_pot._poentry(self._outf, 'dummy', 2, "ham", 'EGG')
84
self.check_output('''\
88
96
def test_duplicate(self):
89
97
export_pot._poentry(self._outf, 'dummy', 1, "spam")
90
98
# This should be ignored.
91
99
export_pot._poentry(self._outf, 'dummy', 2, "spam", 'EGG')
94
self._outf.getvalue(),
101
self.check_output('''\
108
class TestPoentryPerPergraph(PoEntryTestCase):
110
def test_single(self):
111
export_pot._poentry_per_paragraph(
115
'''foo\nbar\nbaz\n'''
117
self.check_output('''\
126
def test_multi(self):
127
export_pot._poentry_per_paragraph(
131
'''spam\nham\negg\n\nSPAM\nHAM\nEGG\n'''
133
self.check_output('''\