@@ -136,6 +136,25 @@ def test_header(self):
136136
137137 #"Plural-Forms" is optional
138138
139+ @unittest .skipIf (sys .platform .startswith ('aix' ),
140+ 'bpo-29972: broken test on AIX' )
141+ def test_POT_Creation_Date (self ):
142+ """ Match the date format from xgettext for POT-Creation-Date """
143+ from datetime import datetime
144+ with temp_cwd (None ) as cwd :
145+ assert_python_ok ('-Xutf8' , self .script )
146+ with open ('messages.pot' , encoding = 'utf-8' ) as fp :
147+ data = fp .read ()
148+ header = self .get_header (data )
149+ creationDate = header ['POT-Creation-Date' ]
150+
151+ # peel off the escaped newline at the end of string
152+ if creationDate .endswith ('\\ n' ):
153+ creationDate = creationDate [:- len ('\\ n' )]
154+
155+ # This will raise if the date format does not exactly match.
156+ datetime .strptime (creationDate , '%Y-%m-%d %H:%M%z' )
157+
139158 def test_msgid (self ):
140159 msgids = self .extract_docstrings_from_str (
141160 '''_("""doc""" r'str' u"ing")''' )
@@ -220,26 +239,6 @@ def test_calls_in_fstring_with_partially_wrong_expression(self):
220239 self .assertNotIn ('foo' , msgids )
221240 self .assertIn ('bar' , msgids )
222241
223- @unittest .skipIf (sys .platform .startswith ('aix' ),
224- 'bpo-29972: broken test on AIX' )
225- def test_POT_Creation_Date (self ):
226- """ Match the date format from xgettext for POT-Creation-Date """
227- from datetime import datetime
228- with temp_cwd (None ) as cwd :
229- assert_python_ok ('-Xutf8' , self .script )
230- with open ('messages.pot' , encoding = 'utf-8' ) as fp :
231- data = fp .read ()
232- header = self .get_header (data )
233- creationDate = header ['POT-Creation-Date' ]
234-
235- # peel off the escaped newline at the end of string
236- if creationDate .endswith ('\\ n' ):
237- creationDate = creationDate [:- len ('\\ n' )]
238-
239- # This will raise if the date format does not exactly match.
240- datetime .strptime (creationDate , '%Y-%m-%d %H:%M%z' )
241-
242-
243242 def test_function_and_class_names (self ):
244243 """Test that function and class names are not mistakenly extracted."""
245244 msgids = self .extract_from_str (dedent ('''\
0 commit comments