From: Bradley Laney Date: Tue, 10 Jul 2018 09:46:44 +0000 (-0400) Subject: bpo-34031: fix incorrect usage of self.fail in two tests (GH-8091) X-Git-Tag: v3.8.0a1~1391 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6b490b5db40fc29588e8e6cc23bb89c4fed74ad5;p=thirdparty%2FPython%2Fcpython.git bpo-34031: fix incorrect usage of self.fail in two tests (GH-8091) Contributed by Bradley Laney. --- diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py index 9890b8c586f3..f58d1dae6045 100644 --- a/Lib/test/test_file.py +++ b/Lib/test/test_file.py @@ -241,8 +241,7 @@ class OtherFileTests: # Test for appropriate errors mixing read* and iteration for methodname, args in methods: f = self.open(TESTFN, 'rb') - if next(f) != filler: - self.fail, "Broken testfile" + self.assertEqual(next(f), filler) meth = getattr(f, methodname) meth(*args) # This simply shouldn't fail f.close() diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py index 52c897af433c..77dec0ce713c 100644 --- a/Lib/test/test_urllib2_localnet.py +++ b/Lib/test/test_urllib2_localnet.py @@ -306,7 +306,7 @@ class BasicAuthTests(unittest.TestCase): try: self.assertTrue(urllib.request.urlopen(self.server_url)) except urllib.error.HTTPError: - self.fail("Basic auth failed for the url: %s", self.server_url) + self.fail("Basic auth failed for the url: %s" % self.server_url) def test_basic_auth_httperror(self): ah = urllib.request.HTTPBasicAuthHandler()