]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[2.7] bpo-34031: fix incorrect usage of self.fail in two tests (GH-8091) (#8225)
authorTal Einat <taleinat+github@gmail.com>
Tue, 10 Jul 2018 10:28:09 +0000 (13:28 +0300)
committerGitHub <noreply@github.com>
Tue, 10 Jul 2018 10:28:09 +0000 (13:28 +0300)
Actually just one fix on the 2.7 branch.

Contributed by Bradley Laney.

(cherry picked from commit 6b490b5db40fc29588e8e6cc23bb89c4fed74ad5)

Lib/test/test_file.py

index 57e640d336416ba7f0af7338a68045c3bf99b902..6bfc4e63e7bb6c87d52e3662bda000dbf82b3b55 100644 (file)
@@ -247,8 +247,7 @@ class OtherFileTests(unittest.TestCase):
         # 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()