Commit 7fb4da76 authored by Ezio Melotti's avatar Ezio Melotti

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.
........
parent b24ef196
...@@ -166,7 +166,7 @@ class OtherFileTests(unittest.TestCase): ...@@ -166,7 +166,7 @@ class OtherFileTests(unittest.TestCase):
except ValueError as msg: except ValueError as msg:
if msg.args[0] != 0: if msg.args[0] != 0:
s = str(msg) 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) self.fail("bad error message for invalid mode: %s" % s)
# if msg.args[0] == 0, we're probably on Windows where there may be # if msg.args[0] == 0, we're probably on Windows where there may be
# no obvious way to discover why open() failed. # no obvious way to discover why open() failed.
......
...@@ -318,7 +318,7 @@ class OtherFileTests(unittest.TestCase): ...@@ -318,7 +318,7 @@ class OtherFileTests(unittest.TestCase):
except ValueError as msg: except ValueError as msg:
if msg.args[0] != 0: if msg.args[0] != 0:
s = str(msg) 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) self.fail("bad error message for invalid mode: %s" % s)
# if msg.args[0] == 0, we're probably on Windows where there may be # if msg.args[0] == 0, we're probably on Windows where there may be
# no obvious way to discover why open() failed. # no obvious way to discover why open() failed.
......
...@@ -432,7 +432,7 @@ class MinidomTest(unittest.TestCase): ...@@ -432,7 +432,7 @@ class MinidomTest(unittest.TestCase):
string1 = repr(el) string1 = repr(el)
string2 = str(el) string2 = str(el)
self.confirm(string1 == string2) self.confirm(string1 == string2)
self.confirm(string1.find("slash:abc") != -1) self.confirm("slash:abc" in string1)
dom.unlink() dom.unlink()
def testAttributeRepr(self): def testAttributeRepr(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment