Closed mesozoic closed 11 years ago
@bukzor These two commits should address your earlier feedback. This now supports custom assertion functions:
class MyTest(T.TestCase):
def throw_user_warning(self):
warnings.warn('Whoa!')
def assert_three_user_warnings(self, warnings):
T.assert_equal(['Whoa!'], [str(w) for w in warnings])
def test_with_custom_assertions(self):
T.assert_warns_such_that(self.assert_three_user_warnings):
self.throw_user_warning()
Looks right.
lgtm. shipit.
If no other concerns, will merge 10/14
Since I had to tweak some other warning-related stuff to make some tests pass in Python 2.7, I verified that these new warning-related tests work with 2.7 as well. \o/
Thanks for the patch @aclevy!
This branch adds an
assert_warns
method to thetestify.assertions
module. This allows the following syntax: