Skip to content

Instantly share code, notes, and snippets.

@SamuraiT
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SamuraiT/9047319 to your computer and use it in GitHub Desktop.
Save SamuraiT/9047319 to your computer and use it in GitHub Desktop.
MarkdownParser example with test code
class MarkdownParser(object):
def convert_to_paragraph(self, mes):
return '<p>{mes}</p>'.format(mes = mes)
import unittest
from MarkdownParser import MarkdownParser
class TestMarkdownParser(unittest.TestCase):
def test_convert_to_paragraph(self):
#setup
mes = 'hello TDD world :D'
expected = '<p>hello TDD world :D</p>'
#execute
parser = MarkdownParser()
actual = parser.convert_to_paragraph(mes)
#verify
self.assertEqual(actual, expected)
#teardown
#this time you don't need this process
if __name__ == '__main__':
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment