Last active
August 29, 2015 13:56
-
-
Save SamuraiT/9047319 to your computer and use it in GitHub Desktop.
MarkdownParser example with test code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MarkdownParser(object): | |
def convert_to_paragraph(self, mes): | |
return '<p>{mes}</p>'.format(mes = mes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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