diff options
author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2019-02-12 17:41:25 +0000 |
---|---|---|
committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2019-02-12 17:41:25 +0000 |
commit | 9f46483bb01cb9ca071d0c18e469b19370764403 (patch) | |
tree | f4c72a5c4062f7d445e9b1f2edc92b9edb1c56a6 | |
parent | ef911d4bdf376009474bf4d068bbd96eebb15a47 (diff) | |
download | docutils-9f46483bb01cb9ca071d0c18e469b19370764403.tar.gz |
Use compatibility definitions for assertIn and assertNotIn only if required.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8245 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r-- | docutils/test/DocutilsTestSupport.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/docutils/test/DocutilsTestSupport.py b/docutils/test/DocutilsTestSupport.py index 4724f5e4c..0f743e168 100644 --- a/docutils/test/DocutilsTestSupport.py +++ b/docutils/test/DocutilsTestSupport.py @@ -130,17 +130,18 @@ class StandardTestCase(unittest.TestCase): msg or '%s == %s' % _format_str(first, second)) # assertIn and assertNotIn: new in Python 2.7: - - def assertIn(self, a, b, msg=None): - if a not in b: - raise self.failureException, ( - msg or '%s not in %s' % _format_str(a, b)) - - def assertNotIn(self, a, b, msg=None): - if a in b: - raise self.failureException, ( - msg or '%s in %s' % _format_str(a, b)) - + if sys.version_info < (2,7): + + def assertIn(self, a, b, msg=None): + if a not in b: + raise self.failureException, ( + msg or '%s not in %s' % _format_str(a, b)) + + def assertNotIn(self, a, b, msg=None): + if a in b: + raise self.failureException, ( + msg or '%s in %s' % _format_str(a, b)) + # aliases for assertion methods, deprecated since Python 2.7 failUnlessEqual = assertEquals = assertEqual |