matt chisholm avatar matt chisholm committed 435ff92

use unittest.TestCase and assertEquals

Comments (0)

Files changed (1)

 from pottymouth import PottyMouth, Node, Token
-class TestPottyMouth(object):
+class TestPottyMouth(unittest.TestCase):
-    def setup(self):
+    def setUp(self):
         self.parser = PottyMouth(
     def test_repr(self):
-        assert repr(self.parser.parse("foo • bar")) == "[[[TEXT{u'foo'}], [BULLET{u' \\u2022 '}], [TEXT{u'bar'}]]]"
-        assert repr(self.parser.parse("foo • bar".encode('utf8'))) == "[[[TEXT{u'foo'}], [BULLET{u' \\u2022 '}], [TEXT{u'bar'}]]]"
+        self.assertEquals(repr(self.parser.parse("foo • bar")), "[[[TEXT{u'foo'}], [BULLET{u' \\u2022 '}], [TEXT{u'bar'}]]]")
+        self.assertEquals(repr(self.parser.parse("foo • bar".encode('utf8'))), "[[[TEXT{u'foo'}], [BULLET{u' \\u2022 '}], [TEXT{u'bar'}]]]")
     def _helper(self, source, expected):
             result = list('\n'), generated.split(b'\n')))
             print b'\n'.join(result)
             print source.encode('utf8')
-            assert generated == expected
+            self.assertEquals(generated, expected)
     def test_some_paragraphs(self):
         self._helper('\n\t\n\n', [])
     def test_tokenizer(self):
-        assert(self.parser.tokenize("A *BOLD* thing") == [Token('TEXT', 'A '), Token('STAR', '*'), Token('TEXT', 'BOLD'), Token('ITEMSTAR', '* '), Token('TEXT', 'thing'),])
+        self.assertEquals(self.parser.tokenize("A *BOLD* thing"), [Token('TEXT', 'A '), Token('STAR', '*'), Token('TEXT', 'BOLD'), Token('ITEMSTAR', '* '), Token('TEXT', 'thing'),])
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.