MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_header

Method test_header

Lib/test/test_tools/test_i18n.py:107–131  ·  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

105 return self.extract_from_str(module_content, args=('--docstrings',), strict=False)
106
107 def test_header(self):
108 """Make sure the required fields are in the header, according to:
109 http://www.gnu.org/software/gettext/manual/gettext.html#Header-Entry
110 """
111 with temp_cwd(None) as cwd:
112 assert_python_ok('-Xutf8', self.script)
113 with open('messages.pot', encoding='utf-8') as fp:
114 data = fp.read()
115 header = self.get_header(data)
116
117 self.assertIn("Project-Id-Version", header)
118 self.assertIn("POT-Creation-Date", header)
119 self.assertIn("PO-Revision-Date", header)
120 self.assertIn("Last-Translator", header)
121 self.assertIn("Language-Team", header)
122 self.assertIn("MIME-Version", header)
123 self.assertIn("Content-Type", header)
124 self.assertIn("Content-Transfer-Encoding", header)
125 self.assertIn("Generated-By", header)
126
127 # not clear if these should be required in POT (template) files
128 #self.assertIn("Report-Msgid-Bugs-To", header)
129 #self.assertIn("Language", header)
130
131 #"Plural-Forms" is optional
132
133 @unittest.skipIf(sys.platform.startswith('aix'),
134 '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