import unittest from simple_footnotes import parse_for_footnotes class PseudoArticleGenerator(object): articles = [] class PseudoArticle(object): _content = "" slug = "article" class TestFootnotes(unittest.TestCase): def _expect(self, input, expected_output): ag = PseudoArticleGenerator() art = PseudoArticle() art._content = input ag.articles = [art] parse_for_footnotes(ag) self.assertEqual(art._content, expected_output) def test_simple(self): self._expect( "words[ref]footnote[/ref]end", ( 'words1end' '
    ' u'
  1. footnote \u21a9
  2. ' "
" ), ) def test_no_footnote_inside_code(self): self._expect( "wordsthis is code[ref]footnote[/ref] end code end", "wordsthis is code[ref]footnote[/ref] end code end", ) if __name__ == "__main__": unittest.main()