MCPcopy Create free account
hub / github.com/python/cpython / test_POT_Creation_Date

Method test_POT_Creation_Date

Lib/test/test_tools/test_i18n.py:148–163  ·  view source on GitHub ↗

Match the date format from xgettext for POT-Creation-Date

(self)

Source from the content-addressed store, hash-verified

146 @unittest.skipIf(sys.platform.startswith('aix'),
147 'bpo-29972: broken test on AIX')
148 def test_POT_Creation_Date(self):
149 """ Match the date format from xgettext for POT-Creation-Date """
150 from datetime import datetime
151 with temp_cwd(None) as cwd:
152 assert_python_ok('-Xutf8', self.script)
153 with open('messages.pot', encoding='utf-8') as fp:
154 data = fp.read()
155 header = self.get_header(data)
156 creationDate = header['POT-Creation-Date']
157
158 # peel off the escaped newline at the end of string
159 if creationDate.endswith('\\n'):
160 creationDate = creationDate[:-len('\\n')]
161
162 # This will raise if the date format does not exactly match.
163 datetime.strptime(creationDate, '%Y-%m-%d %H:%M%z')
164
165 def test_output_option(self):
166 for opt in ('-o', '--output='):

Callers

nothing calls this directly

Calls 7

get_headerMethod · 0.95
temp_cwdFunction · 0.90
assert_python_okFunction · 0.90
openFunction · 0.50
readMethod · 0.45
endswithMethod · 0.45
strptimeMethod · 0.45

Tested by

no test coverage detected