from babel import __version__ as VERSION
from babel.dates import format_datetime
from babel.messages import frontend, Catalog
-from babel.messages.frontend import CommandLineInterface, extract_messages, update_catalog
+from babel.messages.frontend import CommandLineInterface, extract_messages, update_catalog, po_file_read_mode
from babel.util import LOCALTZ
from babel.messages.pofile import read_po, write_po
from babel._compat import StringIO
self.cmd.finalize_options()
self.cmd.run()
- with open(self._pot_file(), 'U') as f:
+ with open(self._pot_file(), po_file_read_mode) as f:
catalog = read_po(f)
msg = catalog.get('bar')
self.assertEqual(1, len(msg.locations))
'year': time.strftime('%Y'),
'date': format_datetime(datetime(1994, 11, 11, 00, 00), 'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale='en')}
- with open(self._pot_file(), 'U') as f:
+ with open(self._pot_file(), po_file_read_mode) as f:
actual_content = f.read()
self.assertEqual(expected_content, actual_content)
'year': time.strftime('%Y'),
'date': format_datetime(datetime(1994, 11, 11, 00, 00), 'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale='en')}
- with open(self._pot_file(), 'U') as f:
+ with open(self._pot_file(), po_file_read_mode) as f:
actual_content = f.read()
self.assertEqual(expected_content, actual_content)
'year': time.strftime('%Y'),
'date': format_datetime(datetime(1994, 11, 11, 00, 00), 'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale='en')}
- with open(self._pot_file(), 'U') as f:
+ with open(self._pot_file(), po_file_read_mode) as f:
actual_content = f.read()
self.assertEqual(expected_content, actual_content)
msgstr[1] ""
"""
- with open(self._pot_file(), 'U') as f:
+ with open(self._pot_file(), po_file_read_mode) as f:
actual_content = f.read()
self.assertEqual(expected_content, actual_content)
""" % {'version': VERSION,
'date': format_datetime(datetime(1994, 11, 11, 00, 00), 'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale='en')}
- with open(po_file, 'U') as f:
+ with open(po_file, po_file_read_mode) as f:
actual_content = f.read()
self.assertEqual(expected_content, actual_content)
""" % {'version': VERSION,
'date': format_datetime(datetime(1994, 11, 11, 00, 00), 'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale='en')}
- with open(po_file, 'U') as f:
+ with open(po_file, po_file_read_mode) as f:
actual_content = f.read()
self.assertEqual(expected_content, actual_content)
""" % {'version': VERSION,
'date': format_datetime(datetime(1994, 11, 11, 00, 00), 'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale='en')}
- with open(po_file, 'U') as f:
+ with open(po_file, po_file_read_mode) as f:
actual_content = f.read()
self.assertEqual(expected_content, actual_content)
""" % {'version': VERSION,
'date': format_datetime(datetime(1994, 11, 11, 00, 00), 'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale='ja_JP')}
- with open(po_file, 'U') as f:
+ with open(po_file, po_file_read_mode) as f:
actual_content = f.read()
self.assertEqual(expected_content, actual_content)
'date': format_datetime(datetime(1994, 11, 11, 00, 00), 'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale='en_US'),
'long_message': long_message}
- with open(po_file, 'U') as f:
+ with open(po_file, po_file_read_mode) as f:
actual_content = f.read()
self.assertEqual(expected_content, actual_content)
'date': format_datetime(datetime(1994, 11, 11, 00, 00), 'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale='en_US'),
'long_message': long_message}
- with open(po_file, 'U') as f:
+ with open(po_file, po_file_read_mode) as f:
actual_content = f.read()
self.assertEqual(expected_content, actual_content)
'year': time.strftime('%Y'),
'date': format_datetime(datetime(1994, 11, 11, 00, 00), 'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale='en')}
- with open(pot_file, 'U') as f:
+ with open(pot_file, po_file_read_mode) as f:
actual_content = f.read()
self.assertEqual(expected_content, actual_content)
'year': time.strftime('%Y'),
'date': format_datetime(datetime(1994, 11, 11, 00, 00), 'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale='en')}
- with open(pot_file, 'U') as f:
+ with open(pot_file, po_file_read_mode) as f:
actual_content = f.read()
self.assertEqual(expected_content, actual_content)
'year': time.strftime('%Y'),
'date': format_datetime(datetime(1994, 11, 11, 00, 00), 'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale='en')}
- with open(pot_file, 'U') as f:
+ with open(pot_file, po_file_read_mode) as f:
actual_content = f.read()
self.assertEqual(expected_content, actual_content)
""" % {'version': VERSION,
'date': format_datetime(datetime(1994, 11, 11, 00, 00), 'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale='en')}
- with open(po_file, 'U') as f:
+ with open(po_file, po_file_read_mode) as f:
actual_content = f.read()
self.assertEqual(expected_content, actual_content)
""" % {'version': VERSION,
'date': format_datetime(datetime(1994, 11, 11, 00, 00), 'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale='en')}
- with open(po_file, 'U') as f:
+ with open(po_file, po_file_read_mode) as f:
actual_content = f.read()
self.assertEqual(expected_content, actual_content)
""" % {'version': VERSION,
'date': format_datetime(datetime(1994, 11, 11, 00, 00), 'yyyy-MM-dd HH:mmZ',
tzinfo=LOCALTZ, locale='en')}
- with open(po_file, 'U') as f:
+ with open(po_file, po_file_read_mode) as f:
actual_content = f.read()
self.assertEqual(expected_content, actual_content)