Quite a bit of work on new public errors and their unit tests

This commit is contained in:
Jason Gerard DeRose
2009-01-04 03:52:08 -07:00
parent c161784973
commit 2608838ef1
4 changed files with 187 additions and 16 deletions
+8
View File
@@ -99,6 +99,14 @@ class ExceptionNotRaised(Exception):
return self.msg % self.expected.__name__
def assert_equal(val1, val2):
"""
Assert ``val1`` and ``val2`` are the same type and of equal value.
"""
assert type(val1) is type(val2), '%r != %r' % (val1, val2)
assert val1 == val2, '%r != %r' % (val1, val2)
def raises(exception, callback, *args, **kw):
"""
Tests that the expected exception is raised; raises ExceptionNotRaised