Commits

Mike Orr  committed b82df08

Add 'raises' function.

  • Participants
  • Parent commits bd93631

Comments (0)

Files changed (1)

File tests/util.py

 
 import routes
 
+def raises(exc, func, *args, **kw):
+    try:
+        func(*args, **kw)
+    except exc:
+        pass
+    else:
+        tup = func.__name__, e.__name__
+        raise AssertionError("%s() did not raise %s" % tup)
+
 def test_environ():
     return {
         'HTTP_HOST': 'bob.local:5000',