From ed552e0fc71db76eca3d962b04fc1e4dca9fe3ae Mon Sep 17 00:00:00 2001 From: Maurits van Rees Date: Mon, 5 Mar 2018 14:08:22 +0100 Subject: Added test for Python 3 unicode error translate. --- src/zope/tal/tests/test_talgettext.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/zope/tal/tests/test_talgettext.py') diff --git a/src/zope/tal/tests/test_talgettext.py b/src/zope/tal/tests/test_talgettext.py index d3b57d0..1e3b3f9 100644 --- a/src/zope/tal/tests/test_talgettext.py +++ b/src/zope/tal/tests/test_talgettext.py @@ -118,6 +118,24 @@ class test_POEngine(unittest.TestCase): ['A link.', 'Some ${DYNAMIC_CONTENT} text.']) + def test_potalinterpreter_translate_default(self): + sample_source = '

text

' + p = HTMLTALParser() + p.parseString(sample_source) + program, macros = p.getCode() + engine = POEngine() + engine.file = 'sample_source' + interpreter = POTALInterpreter( + program, macros, engine, stream=StringIO(), metal=False) + # We simply call this, to make sure we don't get a NameError + # for 'unicode' in python 3. + # The return value (strangely: 'x') is not interesting here. + interpreter.translate('text') + msgids = [] + for domain in engine.catalog.values(): + msgids += list(domain) + self.assertIn('text', msgids) + def test_suite(): return unittest.defaultTestLoader.loadTestsFromName(__name__) -- cgit v1.2.1