From 1c9f515466b7648fbfef8607d9360211e977b05a Mon Sep 17 00:00:00 2001 From: milde Date: Mon, 26 Aug 2019 16:42:23 +0000 Subject: py3: Replace deprecated form of raising exception Signed-off-by: Stephen Finucane git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8353 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- docutils/test/DocutilsTestSupport.py | 21 ++++----------------- docutils/test/package_unittest.py | 2 +- 2 files changed, 5 insertions(+), 18 deletions(-) (limited to 'docutils/test') diff --git a/docutils/test/DocutilsTestSupport.py b/docutils/test/DocutilsTestSupport.py index eb9b8fa39..2d40989f5 100644 --- a/docutils/test/DocutilsTestSupport.py +++ b/docutils/test/DocutilsTestSupport.py @@ -123,30 +123,17 @@ class StandardTestCase(unittest.TestCase): operator. """ if not first == second: - raise self.failureException, ( - msg or '%s != %s' % _format_str(first, second)) + raise self.failureException( + msg or '%s != %s' % _format_str(first, second)) def assertNotEqual(self, first, second, msg=None): """Fail if the two objects are equal as determined by the '==' operator. """ if first == second: - raise self.failureException, ( - msg or '%s == %s' % _format_str(first, second)) + raise self.failureException( + msg or '%s == %s' % _format_str(first, second)) - # assertIn and assertNotIn: new in Python 2.7: - 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 diff --git a/docutils/test/package_unittest.py b/docutils/test/package_unittest.py index 57b6c945b..9c35723ab 100644 --- a/docutils/test/package_unittest.py +++ b/docutils/test/package_unittest.py @@ -120,7 +120,7 @@ def loadTestModules(path, name='', packages=None): elif isinstance(suite, unittest.TestSuite): testSuite.addTest(suite) else: - raise AssertionError, "don't understand suite (%s)" % mod + raise AssertionError("don't understand suite (%s)" % mod) sys.path.pop(0) return testSuite -- cgit v1.2.1