MCPcopy Index your code
hub / github.com/python/cpython / test_header

Method test_header

Lib/test/test_tools/test_i18n.py:120–144  ·  view source on GitHub ↗

Make sure the required fields are in the header, according to: http://www.gnu.org/software/gettext/manual/gettext.html#Header-Entry

(self)

Source from the content-addressed store, hash-verified

118 return self.extract_from_str(module_content, strict=False, with_stderr=True)[1]
119
120 def test_header(self):
121 """Make sure the required fields are in the header, according to:
122 http://www.gnu.org/software/gettext/manual/gettext.html#Header-Entry
123 """
124 with temp_cwd(None) as cwd:
125 assert_python_ok('-Xutf8', self.script)
126 with open('messages.pot', encoding='utf-8') as fp:
127 data = fp.read()
128 header = self.get_header(data)
129
130 self.assertIn("Project-Id-Version", header)
131 self.assertIn("POT-Creation-Date", header)
132 self.assertIn("PO-Revision-Date", header)
133 self.assertIn("Last-Translator", header)
134 self.assertIn("Language-Team", header)
135 self.assertIn("MIME-Version", header)
136 self.assertIn("Content-Type", header)
137 self.assertIn("Content-Transfer-Encoding", header)
138 self.assertIn("Generated-By", header)
139
140 # not clear if these should be required in POT (template) files
141 #self.assertIn("Report-Msgid-Bugs-To", header)
142 #self.assertIn("Language", header)
143
144 #"Plural-Forms" is optional
145
146 @unittest.skipIf(sys.platform.startswith('aix'),
147 'bpo-29972: broken test on AIX')

Callers

nothing calls this directly

Calls 6

get_headerMethod · 0.95
temp_cwdFunction · 0.90
assert_python_okFunction · 0.90
assertInMethod · 0.80
openFunction · 0.50
readMethod · 0.45

Tested by

no test coverage detected