Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def assert_case(self, n, text, html):
result = mistune.html(text)
self.assertEqual(result, html)
def assert_case(self, n, text, html):
result = mistune.html(text)
# normalize to match commonmark
result = re.sub(r'\s*\n+\s*', '\n', result)
result = re.sub(r'>\n', '>', result)
result = re.sub(r'\n<', '<', result)
expect = re.sub(r'\s*\n+\s*', '\n', html)
expect = re.sub(r'>\n', '>', expect)
expect = re.sub(r'\n<', '<', expect)
if n in DIFFERENCES:
expect = DIFFERENCES[n](expect)
self.assertEqual(result, expect)
def test_none(self):
self.assertEqual(mistune.html(None), '')
def markdown(context, path):
template_path = context.name
path = template_dir.joinpath(template_path).parent.joinpath(path)
html = mistune.html(open(path, 'r').read())
return html