# HG changeset patch # User Brian Neal # Date 1749302907 18000 # Node ID df3473a1ee8c015d6882dd793ecdf7ae3117630e # Parent 05d618e3f3536db6beffb689c1e0af4a9683b18e Add unit tests for core.markup diff -r 05d618e3f353 -r df3473a1ee8c core/mdexts/deleted.py --- a/core/mdexts/deleted.py Fri Jun 06 08:18:35 2025 -0500 +++ b/core/mdexts/deleted.py Sat Jun 07 08:28:27 2025 -0500 @@ -1,6 +1,6 @@ """ A python-markdown extension to add support for . -The Markdown syntax is --this is deleted text--. +The Markdown syntax is ---this is deleted text---. """ import markdown diff -r 05d618e3f353 -r df3473a1ee8c core/tests/test_markup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/tests/test_markup.py Sat Jun 07 08:28:27 2025 -0500 @@ -0,0 +1,59 @@ +""" +Tests for the core markup module. + +""" +import textwrap +import unittest + +from django.test import TestCase + +from core.markup import Markdown, markdown, SiteMarkup, site_markup + + +class MarkdownTestCase(unittest.TestCase): + + TEST_TEXT = textwrap.dedent("""\ + Some text. + https://example.com + ---deleted text--- + """) + + EXPECTED = textwrap.dedent(u"""\ +

Some text.
+ https://example.com
+ deleted text

""") + + def test_markdown_class(self): + md = Markdown() + output = md.convert(self.TEST_TEXT) + self.assertEqual(output, self.EXPECTED) + + def test_markdown_function(self): + output = markdown(self.TEST_TEXT) + self.assertEqual(output, self.EXPECTED) + + +class SiteMarkdupTestCase(TestCase): + fixtures = ['smilies.json'] + + TEST_TEXT = textwrap.dedent("""\ + Some text. + https://example.com + ---deleted text--- + :sg101: + """) + + EXPECTED = textwrap.dedent(u"""\ +

Some text.
+ https://example.com
+ deleted text
+ SG101!

""") + + def test_site_markup_class(self): + sm = SiteMarkup() + output = sm.convert(self.TEST_TEXT) + self.assertEqual(output, self.EXPECTED) + + def test_site_markup_function(self): + output = site_markup(self.TEST_TEXT) + self.assertEqual(output, self.EXPECTED)