Merged revisions 79024 via svnmerge from

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.
........
This commit is contained in:
Ezio Melotti 2010-03-18 12:29:13 +00:00
parent b24ef1963d
commit 7fb4da7650
3 changed files with 3 additions and 3 deletions

View 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.

View 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.

View 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):