4 This module contains helpful functions called by each module's test suite.
6 from types import FunctionType, MethodType, ClassType, TypeType
9 class TestException(Exception):
10 """Exception class for test failures."""
14 """Print a test message."""
15 if type(subject) in (MethodType, FunctionType, ClassType, TypeType):
16 print "testing %s()..." % subject.__name__,
18 print "testing %s..." % subject,
22 """Print a success message."""
26 def assert_equal(expected, actual):
27 if expected != actual:
28 message = "Expected (%s)\nWas (%s)" % (repr(expected), repr(actual))
34 raise TestException("Test failed:\n%s" % message)
37 def negative(call, args, excep, message):