4 from nose.tools import *
6 __all__ = ['assert_instance_of', 'assert_not_instance_of',
7 'assert_none', 'assert_not_none',
8 'assert_match', 'assert_not_match'] + tools.__all__
10 def assert_instance_of(expected, actual, msg=None):
11 """Verify that object is an instance of expected """
12 assert isinstance(actual, expected), msg
14 def assert_not_instance_of(expected, actual, msg=None):
15 """Verify that object is not an instance of expected """
16 assert not isinstance(actual, expected, msg)
18 def assert_none(actual, msg=None):
19 """verify that item is None"""
20 assert_equal(None, actual, msg)
22 def assert_not_none(actual, msg=None):
23 """verify that item is None"""
24 assert_not_equal(None, actual, msg)
26 def assert_match(pattern, string, msg=None):
27 """verify that the pattern matches the string"""
28 assert_not_none(re.search(pattern, string), msg)
30 def assert_not_match(pattern, string, msg=None):
31 """verify that the pattern does not match the string"""
32 assert_none(re.search(pattern, string), msg)