view babel/messages/tests/extract.py @ 82:f421e5576d26

Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
author palgarvio
date Sun, 10 Jun 2007 14:21:01 +0000
parents 27d55a07c897
children e10f82c1d4c4
line wrap: on
line source
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists of voluntary contributions made by many
# individuals. For the exact contribution history, see the revision
# history and logs, available at http://babel.edgewall.org/log/.

import doctest
from StringIO import StringIO
import unittest

from babel.messages import extract


class ExtractPythonTestCase(unittest.TestCase):

    def test_unicode_string_arg(self):
        buf = StringIO("msg = _(u'Foo Bar')")
        messages = list(extract.extract_python(buf, ('_',), {}, []))
        self.assertEqual('Foo Bar', messages[0][2])


def suite():
    suite = unittest.TestSuite()
    suite.addTest(doctest.DocTestSuite(extract))
    suite.addTest(unittest.makeSuite(ExtractPythonTestCase))
    return suite

if __name__ == '__main__':
    unittest.main(defaultTest='suite')
Copyright (C) 2012-2017 Edgewall Software