mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Issue #19777: Provide a home() classmethod on Path objects.
Contributed by Victor Salgado and Mayank Tripathi.
This commit is contained in:
parent
2b4ec1ce8a
commit
17cba7daf5
5 changed files with 34 additions and 0 deletions
|
@ -1261,6 +1261,17 @@ class _BasePathTest(object):
|
|||
p = self.cls.cwd()
|
||||
self._test_cwd(p)
|
||||
|
||||
def _test_home(self, p):
|
||||
q = self.cls(os.path.expanduser('~'))
|
||||
self.assertEqual(p, q)
|
||||
self.assertEqual(str(p), str(q))
|
||||
self.assertIs(type(p), type(q))
|
||||
self.assertTrue(p.is_absolute())
|
||||
|
||||
def test_home(self):
|
||||
p = self.cls.home()
|
||||
self._test_home(p)
|
||||
|
||||
def test_samefile(self):
|
||||
fileA_path = os.path.join(BASE, 'fileA')
|
||||
fileB_path = os.path.join(BASE, 'dirB', 'fileB')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue