Commit 6b490b5d authored by Bradley Laney's avatar Bradley Laney Committed by Tal Einat

bpo-34031: fix incorrect usage of self.fail in two tests (GH-8091)

Contributed by Bradley Laney.
parent 5ac9e6ee
...@@ -241,8 +241,7 @@ class OtherFileTests: ...@@ -241,8 +241,7 @@ class OtherFileTests:
# Test for appropriate errors mixing read* and iteration # Test for appropriate errors mixing read* and iteration
for methodname, args in methods: for methodname, args in methods:
f = self.open(TESTFN, 'rb') f = self.open(TESTFN, 'rb')
if next(f) != filler: self.assertEqual(next(f), filler)
self.fail, "Broken testfile"
meth = getattr(f, methodname) meth = getattr(f, methodname)
meth(*args) # This simply shouldn't fail meth(*args) # This simply shouldn't fail
f.close() f.close()
......
...@@ -306,7 +306,7 @@ class BasicAuthTests(unittest.TestCase): ...@@ -306,7 +306,7 @@ class BasicAuthTests(unittest.TestCase):
try: try:
self.assertTrue(urllib.request.urlopen(self.server_url)) self.assertTrue(urllib.request.urlopen(self.server_url))
except urllib.error.HTTPError: 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): def test_basic_auth_httperror(self):
ah = urllib.request.HTTPBasicAuthHandler() ah = urllib.request.HTTPBasicAuthHandler()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment