10000 bpo-34031: fix incorrect usage of self.fail in two tests (GH-8091) · python/cpython@cb14eb7 · GitHub
[go: up one dir, main page]

Skip to content

Commit cb14eb7

Browse files
bpo-34031: fix incorrect usage of self.fail in two tests (GH-8091)
Contributed by Bradley Laney. (cherry picked from commit 6b490b5) Co-authored-by: Bradley Laney <bradley.laney@gmail.com>
1 parent 6ceab46 commit cb14eb7

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

Lib/test/test_file.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,7 @@ def testIteration(self):
241241
# Test for appropriate errors mixing read* and iteration
242242
for methodname, args in methods:
243243
f = self.open(TESTFN, 'rb')
244-
if next(f) != filler:
245-
self.fail, "Broken testfile"
244+
self.assertEqual(next(f), filler)
246245
meth = getattr(f, methodname)
247246
meth(*args) # This simply shouldn't fail
248247
f.close()

Lib/test/test_urllib2_localnet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def test_basic_auth_success(self):
308308
try:
309309
self.assertTrue(urllib.request.urlopen(self.server_url))
310310
except urllib.error.HTTPError:
311-
self.fail("Basic auth failed for the url: %s", self.server_url)
311+
self.fail("Basic auth failed for the url: %s" % self.server_url)
312312

313313
def test_basic_auth_httperror(self):
314314
ah = urllib.request.HTTPBasicAuthHandler()

0 commit comments

Comments
 (0)
0