diff --git a/tests/test_pagure_lib.py b/tests/test_pagure_lib.py index de7c1d9..a3cd9ff 100644 --- a/tests/test_pagure_lib.py +++ b/tests/test_pagure_lib.py @@ -4295,7 +4295,9 @@ class PagureLibtests(tests.Modeltests): v = tuple([int(c) for c in markdown.version.split('.')]) if v < (2, 6, 7): - raise unittest.case.SkipTest('Skipping on old markdown') + raise unittest.case.SkipTest( + 'Skipping on old markdown that do not strip the orientation row' + ) text = """ | Left-aligned | Center-aligned | Right-aligned | @@ -4335,6 +4337,50 @@ foo bar self.assertEqual(html, expected) + def test_text2markdown_table_old_mk(self): + """ Test the text2markdown function with a markdown table using the old + format where the orientation instruction are provided next to the column + delimiter unlike what can be done with more recent version of markdown. + """ + + text = """ +| Left-aligned | Center-aligned | Right-aligned | +|:--- |:--------------:| ---:| +| git status | git status | git status | +| git diff | git diff | git diff | + + +foo bar + """ + + expected = """ + + + + + + + + + + + + + + + + + + + +
Left-alignedCenter-alignedRight-aligned
git statusgit statusgit status
git diffgit diffgit diff
+

foo bar

""" + + with pagure.APP.app_context(): + html = pagure.lib.text2markdown(text) + self.assertEqual(html, expected) + + if __name__ == '__main__': SUITE = unittest.TestLoader().loadTestsFromTestCase(PagureLibtests) unittest.TextTestRunner(verbosity=2).run(SUITE)