diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-07-10 10:08:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-10 10:08:43 (GMT) |
commit | 125371d2c617d886e1a15b8f940ce29124cdc79c (patch) | |
tree | 01fb5e4d7496e46bcff92a32f296f6c3b8048c6b | |
parent | df9f633f94e97fc43e0235cb2be076491ea7f67f (diff) | |
download | cpython-125371d2c617d886e1a15b8f940ce29124cdc79c.zip cpython-125371d2c617d886e1a15b8f940ce29124cdc79c.tar.gz cpython-125371d2c617d886e1a15b8f940ce29124cdc79c.tar.bz2 |
bpo-34031: fix incorrect usage of self.fail in two tests (GH-8091)
Contributed by Bradley Laney.
(cherry picked from commit 6b490b5db40fc29588e8e6cc23bb89c4fed74ad5)
Co-authored-by: Bradley Laney <bradley.laney@gmail.com>
-rw-r--r-- | Lib/test/test_file.py | 3 | ||||
-rw-r--r-- | Lib/test/test_urllib2_localnet.py | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py index 9890b8c..f58d1da 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 52c897a..77dec0c 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() |