From 15f3644811f0844965dee19978d15ef40911e333 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Thu, 1 May 2014 07:58:02 -0400 Subject: Add some Python 2.6 compatibility. --- OpenSSL/test/util.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/OpenSSL/test/util.py b/OpenSSL/test/util.py index c87ce09..21bbdc4 100644 --- a/OpenSSL/test/util.py +++ b/OpenSSL/test/util.py @@ -210,6 +210,23 @@ class TestCase(TestCase): return containee assertIn = failUnlessIn + def assertNotIn(self, containee, container, msg=None): + """ + Fail the test if C{containee} is found in C{container}. + + @param containee: the value that should not be in C{container} + @param container: a sequence type, or in the case of a mapping type, + will follow semantics of 'if key in dict.keys()' + @param msg: if msg is None, then the failure message will be + '%r in %r' % (first, second) + """ + if containee in container: + raise self.failureException(msg or "%r in %r" + % (containee, container)) + return containee + failIfIn = assertNotIn + + def failUnlessIdentical(self, first, second, msg=None): """ Fail the test if :py:data:`first` is not :py:data:`second`. This is an -- cgit v1.2.1