From 99480be7da89cb82cfff01e5d10a2514546faf39 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 10 Nov 2012 18:19:25 -0500 Subject: Add in assertNotIn. --- test/backunittest.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/backunittest.py') diff --git a/test/backunittest.py b/test/backunittest.py index 84a7f36e..3723dea4 100644 --- a/test/backunittest.py +++ b/test/backunittest.py @@ -36,6 +36,13 @@ class TestCase(unittest.TestCase): msg = msg or ('%r not found in %r' % (member, container)) self.fail(msg) + if _need('assertNotIn'): + def assertNotIn(self, member, container, msg=None): + """Assert that `member` is not in `container`.""" + if member in container: + msg = msg or ('%r found in %r' % (member, container)) + self.fail(msg) + if _need('assertRaisesRegexp'): def assertRaisesRegexp(self, excClass, regexp, callobj, *args, **kw): """ Just like unittest.TestCase.assertRaises, -- cgit v1.2.1