Mercurial > babel > old > mirror
annotate babel/catalog/tests/extract.py @ 38:06b876ed5501
Fix for #8: fix extraction of strings from Python source using prefixes ('u' or 'r') or triple quotes.
author | cmlenz |
---|---|
date | Mon, 04 Jun 2007 21:30:52 +0000 |
parents | 29ef15a6fd75 |
children |
rev | line source |
---|---|
3 | 1 # -*- coding: utf-8 -*- |
2 # | |
14
29ef15a6fd75
* Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents:
3
diff
changeset
|
3 # Copyright (C) 2007 Edgewall Software |
3 | 4 # All rights reserved. |
5 # | |
6 # This software is licensed as described in the file COPYING, which | |
7 # you should have received as part of this distribution. The terms | |
8 # are also available at http://babel.edgewall.org/wiki/License. | |
9 # | |
10 # This software consists of voluntary contributions made by many | |
11 # individuals. For the exact contribution history, see the revision | |
12 # history and logs, available at http://babel.edgewall.org/log/. | |
13 | |
14 import doctest | |
38
06b876ed5501
Fix for #8: fix extraction of strings from Python source using prefixes ('u' or 'r') or triple quotes.
cmlenz
parents:
14
diff
changeset
|
15 from StringIO import StringIO |
3 | 16 import unittest |
17 | |
18 from babel.catalog import extract | |
19 | |
38
06b876ed5501
Fix for #8: fix extraction of strings from Python source using prefixes ('u' or 'r') or triple quotes.
cmlenz
parents:
14
diff
changeset
|
20 |
06b876ed5501
Fix for #8: fix extraction of strings from Python source using prefixes ('u' or 'r') or triple quotes.
cmlenz
parents:
14
diff
changeset
|
21 class ExtractPythonTestCase(unittest.TestCase): |
06b876ed5501
Fix for #8: fix extraction of strings from Python source using prefixes ('u' or 'r') or triple quotes.
cmlenz
parents:
14
diff
changeset
|
22 |
06b876ed5501
Fix for #8: fix extraction of strings from Python source using prefixes ('u' or 'r') or triple quotes.
cmlenz
parents:
14
diff
changeset
|
23 def test_unicode_string_arg(self): |
06b876ed5501
Fix for #8: fix extraction of strings from Python source using prefixes ('u' or 'r') or triple quotes.
cmlenz
parents:
14
diff
changeset
|
24 buf = StringIO("msg = _(u'Foo Bar')") |
06b876ed5501
Fix for #8: fix extraction of strings from Python source using prefixes ('u' or 'r') or triple quotes.
cmlenz
parents:
14
diff
changeset
|
25 messages = list(extract.extract_python(buf, ('_',), {})) |
06b876ed5501
Fix for #8: fix extraction of strings from Python source using prefixes ('u' or 'r') or triple quotes.
cmlenz
parents:
14
diff
changeset
|
26 self.assertEqual('Foo Bar', messages[0][2]) |
06b876ed5501
Fix for #8: fix extraction of strings from Python source using prefixes ('u' or 'r') or triple quotes.
cmlenz
parents:
14
diff
changeset
|
27 |
06b876ed5501
Fix for #8: fix extraction of strings from Python source using prefixes ('u' or 'r') or triple quotes.
cmlenz
parents:
14
diff
changeset
|
28 |
3 | 29 def suite(): |
30 suite = unittest.TestSuite() | |
31 suite.addTest(doctest.DocTestSuite(extract)) | |
38
06b876ed5501
Fix for #8: fix extraction of strings from Python source using prefixes ('u' or 'r') or triple quotes.
cmlenz
parents:
14
diff
changeset
|
32 suite.addTest(unittest.makeSuite(ExtractPythonTestCase)) |
3 | 33 return suite |
34 | |
35 if __name__ == '__main__': | |
36 unittest.main(defaultTest='suite') |