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}
+
def test_get_dir_uid():
if os.getuid(): return # only run if on a scripts server. This is crude
assert get_dir_uid("/mit/ezyang/web_scripts/test-wiki") == 537864399
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"
+