[Zope3-checkins] CVS: Zope3/src/zope/tal/tests - test_talgettext.py:1.1

Nathan R. Yergler nathan@yergler.net
Tue, 25 Mar 2003 18:46:07 -0500


Update of /cvs-repository/Zope3/src/zope/tal/tests
In directory cvs.zope.org:/tmp/cvs-serv23850/tests

Added Files:
	test_talgettext.py 
Log Message:
Added update mode to talgettext; created rudimentary unit tests.


=== Added File Zope3/src/zope/tal/tests/test_talgettext.py ===
#! /usr/bin/env python
##############################################################################
#
# 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.
#
##############################################################################
"""Tests for the talgettext utility."""

import sys
import unittest

from zope.tal.talgettext import POEngine, UpdatePOEngine
from zope.tal.tests import utils

class test_POEngine(unittest.TestCase):
    """Test the PO engine functionality, which simply adds items to a catalog
    as .translate is called
    """
    
    def test_translate(self):
        test_keys = ['foo', 'bar', 'blarf', 'washington']
        
        engine = POEngine()
        for key in test_keys:
            engine.translate(None, key, None)

        for key in test_keys:
            self.failIf( (key not in engine.catalog),
                         "POEngine catalog does not properly store message ids"
                         )

def test_suite():
    suite = unittest.makeSuite(test_POEngine)
    return suite

if __name__ == "__main__":
    errs = utils.run_suite(test_suite())
    sys.exit(errs and 1 or 0)