[Python-checkins] r79024 - in python/trunk/Lib/test: test_file.py test_file2k.py test_fileio.py test_minidom.py

ezio.melotti python-checkins at python.org
Wed Mar 17 15:22:34 CET 2010


Author: ezio.melotti
Date: Wed Mar 17 15:22:34 2010
New Revision: 79024

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

Modified:
   python/trunk/Lib/test/test_file.py
   python/trunk/Lib/test/test_file2k.py
   python/trunk/Lib/test/test_fileio.py
   python/trunk/Lib/test/test_minidom.py

Modified: python/trunk/Lib/test/test_file.py
==============================================================================
--- python/trunk/Lib/test/test_file.py	(original)
+++ python/trunk/Lib/test/test_file.py	Wed Mar 17 15:22:34 2010
@@ -172,7 +172,7 @@
         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.

Modified: python/trunk/Lib/test/test_file2k.py
==============================================================================
--- python/trunk/Lib/test/test_file2k.py	(original)
+++ python/trunk/Lib/test/test_file2k.py	Wed Mar 17 15:22:34 2010
@@ -227,7 +227,7 @@
         except ValueError, 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.

Modified: python/trunk/Lib/test/test_fileio.py
==============================================================================
--- python/trunk/Lib/test/test_fileio.py	(original)
+++ python/trunk/Lib/test/test_fileio.py	Wed Mar 17 15:22:34 2010
@@ -320,7 +320,7 @@
         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.

Modified: python/trunk/Lib/test/test_minidom.py
==============================================================================
--- python/trunk/Lib/test/test_minidom.py	(original)
+++ python/trunk/Lib/test/test_minidom.py	Wed Mar 17 15:22:34 2010
@@ -433,7 +433,7 @@
         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):


More information about the Python-checkins mailing list