mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Use find() instead of looping over the string in expanduser().
From SF patch #757058.
This commit is contained in:
parent
76ca1d428f
commit
a9da5ae07a
2 changed files with 9 additions and 5 deletions
|
@ -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))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue