]> granicus.if.org Git - python/commitdiff
Merged revisions 79024 via svnmerge from
authorEzio Melotti <ezio.melotti@gmail.com>
Thu, 18 Mar 2010 12:29:13 +0000 (12:29 +0000)
committerEzio Melotti <ezio.melotti@gmail.com>
Thu, 18 Mar 2010 12:29:13 +0000 (12:29 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79024 | ezio.melotti | 2010-03-17 16:22:34 +0200 (Wed, 17 Mar 2010) | 1 line

  Use "x in y" instead of y.find(x) != -1.
........

Lib/test/test_file.py
Lib/test/test_fileio.py
Lib/test/test_minidom.py

index 5034a5b4013bafd639669572a468118fc4ca2f5c..6d51fd547fe9570f11b5092684ecd8cccfbd0919 100644 (file)
@@ -166,7 +166,7 @@ class OtherFileTests(unittest.TestCase):
         except ValueError as msg:
             if msg.args[0] != 0:
                 s = str(msg)
-                if s.find(TESTFN) != -1 or s.find(bad_mode) == -1:
+                if TESTFN in s or bad_mode not in s:
                     self.fail("bad error message for invalid mode: %s" % s)
             # if msg.args[0] == 0, we're probably on Windows where there may be
             # no obvious way to discover why open() failed.
index 1493c6f295039b88e12d3d25536d96994b2c5d9a..63bc1d9781e18481a27457851439d42de821c01b 100644 (file)
@@ -318,7 +318,7 @@ class OtherFileTests(unittest.TestCase):
         except ValueError as msg:
             if msg.args[0] != 0:
                 s = str(msg)
-                if s.find(TESTFN) != -1 or s.find(bad_mode) == -1:
+                if TESTFN in s or bad_mode not in s:
                     self.fail("bad error message for invalid mode: %s" % s)
             # if msg.args[0] == 0, we're probably on Windows where there may be
             # no obvious way to discover why open() failed.
index bd20fa14c35d65988471d837075444959fa1d9c8..70f1dbb1e8f716740ca791d796a1c6fae6f7e6f6 100644 (file)
@@ -432,7 +432,7 @@ class MinidomTest(unittest.TestCase):
         string1 = repr(el)
         string2 = str(el)
         self.confirm(string1 == string2)
-        self.confirm(string1.find("slash:abc") != -1)
+        self.confirm("slash:abc" in string1)
         dom.unlink()
 
     def testAttributeRepr(self):