Sfoglia il codice sorgente

Code cleanup in unit tests.

Sander Mathijs van Veen 14 anni fa
parent
commit
7c83ea2582
2 ha cambiato i file con 16 aggiunte e 3 eliminazioni
  1. 16 0
      tests/test_exception.py
  2. 0 3
      tests/test_parser.py

+ 16 - 0
tests/test_exception.py

@@ -0,0 +1,16 @@
+# vim: set fileencoding=utf-8 :
+import unittest
+
+from src.parser import Parser
+from tests.parser import ParserWrapper, run_expressions
+
+
+class TestException(unittest.TestCase):
+    def test_raise(self):
+        try:
+            ParserWrapper(Parser).run(['raise'])
+        except RuntimeError:
+            return
+
+        # pragma: nocover
+        raise AssertionError('Expected a raised RuntimeError!')

+ 0 - 3
tests/test_parser.py

@@ -23,6 +23,3 @@ class TestParser(unittest.TestCase):
 
     def test_line(self):
         self.assertEqual(line(Parser, '4a'), '4 * a')
-
-    def test_raise(self):
-        ParserWrapper(Parser).run(['raise'])