diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2015-01-12 21:03:41 +0100 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2015-01-12 21:03:41 +0100 |
commit | 17cba7daf5cdbe2a0e589be9ef507408b8dc07f1 (patch) | |
tree | 05b7922431dd4d704e4be6b4555bfd4e06dcfd62 /Lib/test/test_pathlib.py | |
parent | 2b4ec1ce8a1e14a0c8de4fbab9442c6260a5f27d (diff) | |
download | cpython-git-17cba7daf5cdbe2a0e589be9ef507408b8dc07f1.tar.gz |
Issue #19777: Provide a home() classmethod on Path objects.
Contributed by Victor Salgado and Mayank Tripathi.
Diffstat (limited to 'Lib/test/test_pathlib.py')
-rw-r--r-- | Lib/test/test_pathlib.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 2e97a5e2de..f4ee519115 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -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') |