annotate babel/messages/tests/catalog.py @ 58:068952b4d4c0

Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
author cmlenz
date Fri, 08 Jun 2007 11:08:03 +0000
parents
children 1d8e81bfedf9
rev   line source
58
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
1 # -*- coding: utf-8 -*-
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
2 #
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
3 # Copyright (C) 2007 Edgewall Software
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
4 # All rights reserved.
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
5 #
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
6 # This software is licensed as described in the file COPYING, which
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
7 # you should have received as part of this distribution. The terms
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
8 # are also available at http://babel.edgewall.org/wiki/License.
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
9 #
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
10 # This software consists of voluntary contributions made by many
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
11 # individuals. For the exact contribution history, see the revision
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
12 # history and logs, available at http://babel.edgewall.org/log/.
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
13
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
14 import doctest
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
15 from StringIO import StringIO
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
16 import unittest
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
17
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
18 from babel.messages import catalog
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
19
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
20
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
21 class MessageTestCase(unittest.TestCase):
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
22
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
23 def test_python_format(self):
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
24 assert catalog.PYTHON_FORMAT('foo %d bar')
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
25 assert catalog.PYTHON_FORMAT('foo %s bar')
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
26 assert catalog.PYTHON_FORMAT('foo %r bar')
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
27
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
28
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
29 def suite():
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
30 suite = unittest.TestSuite()
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
31 suite.addTest(doctest.DocTestSuite(catalog))
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
32 suite.addTest(unittest.makeSuite(MessageTestCase))
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
33 return suite
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
34
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
35 if __name__ == '__main__':
068952b4d4c0 Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
36 unittest.main(defaultTest='suite')
Copyright (C) 2012-2017 Edgewall Software