Match the date format from xgettext for POT-Creation-Date
(self)
| 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='): |
nothing calls this directly
no test coverage detected