MCPcopy Create free account
hub / github.com/Python-Markdown/markdown / generate_test

Method generate_test

markdown/test_tools.py:149–167  ·  view source on GitHub ↗
(infile, outfile, normalize, kwargs)

Source from the content-addressed store, hash-verified

147 def __new__(cls, name, bases, dct):
148
149 def generate_test(infile, outfile, normalize, kwargs):
150 def test(self):
151 with open(infile, encoding="utf-8") as f:
152 input = f.read()
153 with open(outfile, encoding="utf-8") as f:
154 # Normalize line endings
155 # (on Windows, git may have altered line endings).
156 expected = f.read().replace("\r\n", "\n")
157 output = markdown(input, **kwargs)
158 if tidylib and normalize:
159 try:
160 expected = _normalize_whitespace(expected)
161 output = _normalize_whitespace(output)
162 except OSError:
163 self.skipTest("Tidylib's c library not available.")
164 elif normalize:
165 self.skipTest('Tidylib not available.')
166 self.assertMultiLineEqual(output, expected)
167 return test
168
169 location = dct.get('location', '')
170 exclude = dct.get('exclude', [])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected