diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-03-03 12:19:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-03 12:19:29 (GMT) |
commit | fbdd075c64a5229dfa26632cf1b2cf2361dc5003 (patch) | |
tree | a959f2fc206302c629b217ca811f305b7f5060be /Lib/test/test_pathlib.py | |
parent | 10fb1bf7766e7eb9500d328ddd1035e3f823fb57 (diff) | |
download | cpython-fbdd075c64a5229dfa26632cf1b2cf2361dc5003.zip cpython-fbdd075c64a5229dfa26632cf1b2cf2361dc5003.tar.gz cpython-fbdd075c64a5229dfa26632cf1b2cf2361dc5003.tar.bz2 |
[3.6] bpo-32964: Reuse a testing implementation of the path protocol in tests. (GH-5930). (GH-5958)
(cherry picked from commit b21d155f57d284aecf9092a9bd24258293965c2f)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/test/test_pathlib.py')
-rw-r--r-- | Lib/test/test_pathlib.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 6672c44..a4d2f8d 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -11,7 +11,7 @@ import unittest from unittest import mock from test import support -TESTFN = support.TESTFN +from test.support import TESTFN, FakePath try: import grp, pwd @@ -191,18 +191,15 @@ class _BasePurePathTest(object): P = self.cls p = P('a') self.assertIsInstance(p, P) - class PathLike: - def __fspath__(self): - return "a/b/c" P('a', 'b', 'c') P('/a', 'b', 'c') P('a/b/c') P('/a/b/c') - P(PathLike()) + P(FakePath("a/b/c")) self.assertEqual(P(P('a')), P('a')) self.assertEqual(P(P('a'), 'b'), P('a/b')) self.assertEqual(P(P('a'), P('b')), P('a/b')) - self.assertEqual(P(P('a'), P('b'), P('c')), P(PathLike())) + self.assertEqual(P(P('a'), P('b'), P('c')), P(FakePath("a/b/c"))) def _check_str_subclass(self, *args): # Issue #21127: it should be possible to construct a PurePath object |