]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/tests/util_test.py
Fix errors parsing error messages with indents.
[wizard.git] / wizard / tests / util_test.py
index 7907bffe6fcdfd3c108213f8ed83249fce174a29..e4ebe91977d846ec31e0f5599bcc1fa47aaafca9 100644 (file)
@@ -9,6 +9,17 @@ class MyError(Exception):
 ERROR: Foo
 """
 
+class MyErrorWithHTML(Exception):
+    def __str__(self):
+        return """
+
+ERROR: Bar
+
+<html>
+    <title>No good!</title>
+</html>
+"""
+
 def test_dictmap():
     assert dictmap(lambda x: x + 1, {'a': 0, 'b': 1}) == {'a': 1, 'b': 2}
 
@@ -32,3 +43,9 @@ def test_get_exception_name_withstr():
     except MyError:
         assert get_exception_name(traceback.format_exc()) == "MyError"
 
+def test_get_exception_name_withhtml():
+    try:
+        raise MyErrorWithHTML
+    except MyErrorWithHTML:
+        assert get_exception_name(traceback.format_exc()) == "MyErrorWithHTML"
+