diff options
author | Michael Trier <mtrier@gmail.com> | 2008-05-07 16:49:48 -0400 |
---|---|---|
committer | Michael Trier <mtrier@gmail.com> | 2008-05-07 16:49:48 -0400 |
commit | 33ebe7acec14b25c5f84f35a664803fcab2f7781 (patch) | |
tree | 960b40fe368a9882221bcdd8635b9080dec01ec6 /test/asserts.py | |
download | gitpython-33ebe7acec14b25c5f84f35a664803fcab2f7781.tar.gz |
initial project
Diffstat (limited to 'test/asserts.py')
-rw-r--r-- | test/asserts.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/asserts.py b/test/asserts.py new file mode 100644 index 00000000..33dd843b --- /dev/null +++ b/test/asserts.py @@ -0,0 +1,32 @@ +import re +import unittest +from nose import tools +from nose.tools import * + +__all__ = ['assert_instance_of', 'assert_not_instance_of', + 'assert_none', 'assert_not_none', + 'assert_match', 'assert_not_match'] + tools.__all__ + +def assert_instance_of(expected, actual, msg=None): + """Verify that object is an instance of expected """ + assert isinstance(actual, expected), msg + +def assert_not_instance_of(expected, actual, msg=None): + """Verify that object is not an instance of expected """ + assert not isinstance(actual, expected, msg) + +def assert_none(actual, msg=None): + """verify that item is None""" + assert_equal(None, actual, msg) + +def assert_not_none(actual, msg=None): + """verify that item is None""" + assert_not_equal(None, actual, msg) + +def assert_match(pattern, string, msg=None): + """verify that the pattern matches the string""" + assert_not_none(re.search(pattern, string), msg) + +def assert_not_match(pattern, string, msg=None): + """verify that the pattern does not match the string""" + assert_none(re.search(pattern, string), msg)
\ No newline at end of file |