Mercurial > babel > mirror
comparison babel/messages/tests/frontend.py @ 605:6dc7e067bafc trunk
fix 'input_dirs' option for setuptools integration (#232, initial patch by ?tienne Bersac)
author | fschwarz |
---|---|
date | Thu, 23 Aug 2012 09:48:21 +0000 |
parents | e61e27d9347d |
children |
comparison
equal
deleted
inserted
replaced
604:bf5d10a56bbe | 605:6dc7e067bafc |
---|---|
26 | 26 |
27 from babel import __version__ as VERSION | 27 from babel import __version__ as VERSION |
28 from babel.dates import format_datetime | 28 from babel.dates import format_datetime |
29 from babel.messages import frontend | 29 from babel.messages import frontend |
30 from babel.util import LOCALTZ | 30 from babel.util import LOCALTZ |
31 from babel.messages.pofile import read_po | |
31 | 32 |
32 | 33 |
33 this_dir = os.path.abspath(os.path.dirname(__file__)) | 34 this_dir = os.path.abspath(os.path.dirname(__file__)) |
34 | 35 |
35 class CompileCatalogTestCase(unittest.TestCase): | 36 class CompileCatalogTestCase(unittest.TestCase): |
105 def test_both_sort_output_and_sort_by_file(self): | 106 def test_both_sort_output_and_sort_by_file(self): |
106 self.cmd.output_file = 'dummy' | 107 self.cmd.output_file = 'dummy' |
107 self.cmd.sort_output = True | 108 self.cmd.sort_output = True |
108 self.cmd.sort_by_file = True | 109 self.cmd.sort_by_file = True |
109 self.assertRaises(DistutilsOptionError, self.cmd.finalize_options) | 110 self.assertRaises(DistutilsOptionError, self.cmd.finalize_options) |
111 | |
112 def test_input_dirs_is_treated_as_list(self): | |
113 self.cmd.input_dirs = self.datadir | |
114 self.cmd.output_file = self._pot_file() | |
115 self.cmd.finalize_options() | |
116 self.cmd.run() | |
117 | |
118 catalog = read_po(open(self._pot_file(), 'U')) | |
119 msg = catalog.get('bar') | |
120 self.assertEqual(1, len(msg.locations)) | |
121 self.assertTrue('file1.py' in msg.locations[0][0]) | |
122 | |
123 def test_input_dirs_handle_spaces_after_comma(self): | |
124 self.cmd.input_dirs = 'foo, bar' | |
125 self.cmd.output_file = self._pot_file() | |
126 self.cmd.finalize_options() | |
127 | |
128 self.assertEqual(['foo', 'bar'], self.cmd.input_dirs) | |
110 | 129 |
111 def test_extraction_with_default_mapping(self): | 130 def test_extraction_with_default_mapping(self): |
112 self.cmd.copyright_holder = 'FooBar, Inc.' | 131 self.cmd.copyright_holder = 'FooBar, Inc.' |
113 self.cmd.msgid_bugs_address = 'bugs.address@email.tld' | 132 self.cmd.msgid_bugs_address = 'bugs.address@email.tld' |
114 self.cmd.output_file = 'project/i18n/temp.pot' | 133 self.cmd.output_file = 'project/i18n/temp.pot' |