[Zope3-checkins] CVS: Zope3/src/zope/app/translation_files/tests - __init__.py:1.1 test_tokeneater.py:1.1

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Aug 20 13:29:56 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/translation_files/tests
In directory cvs.zope.org:/tmp/cvs-serv14191/translation_files/tests

Added Files:
	__init__.py test_tokeneater.py 
Log Message:
Added support for _(msgid, default) in the extracting tool and created a 
test for it...uhm, we need more tests ;-)


=== Added File Zope3/src/zope/app/translation_files/tests/__init__.py ===


=== Added File Zope3/src/zope/app/translation_files/tests/test_tokeneater.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test Token Eater

$Id: test_tokeneater.py,v 1.1 2003/08/20 16:29:55 srichter Exp $
"""
import unittest
import tokenize
from StringIO import StringIO
from zope.app.translation_files.extract import TokenEater
from zope.app.translation_files.pygettext import make_escapes

class TokenEaterTest(unittest.TestCase):

    def setUp(self):
        self.eater = TokenEater()
        make_escapes(0)
        
    def test_msgid_and_default(self):
        file = StringIO("_('msgid', 'default')")
        tokenize.tokenize(file.readline, self.eater)
        msgid = self.eater._TokenEater__messages.keys()[0]
        self.assertEqual(msgid, 'msgid')
        self.assertEqual(msgid.default, 'default')


def test_suite():
    return unittest.makeSuite(TokenEaterTest)

if __name__ == '__main__':
    unittest.TextTestRunner().run(test_suite())




More information about the Zope3-Checkins mailing list