Use find() instead of looping over the string in expanduser().

From SF patch #757058.
This commit is contained in:
Walter Dörwald 2003-06-19 10:21:14 +00:00
parent 76ca1d428f
commit a9da5ae07a
2 changed files with 9 additions and 5 deletions

View file

@ -332,12 +332,16 @@ class PosixPathTest(unittest.TestCase):
def test_expanduser(self):
self.assertEqual(posixpath.expanduser("foo"), "foo")
self.assert_(isinstance(posixpath.expanduser("~/"), basestring))
try:
import pwd
except ImportError:
pass
else:
self.assert_(isinstance(posixpath.expanduser("~/"), basestring))
self.assertEqual(
posixpath.expanduser("~") + "/",
posixpath.expanduser("~/")
)
self.assert_(isinstance(posixpath.expanduser("~root/"), basestring))
self.assert_(isinstance(posixpath.expanduser("~foo/"), basestring))