bpo-32964: Reuse a testing implementation of the path protocol in tests. (GH-5930)

(cherry picked from commit b21d155f57)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2018-03-02 02:17:51 -08:00 committed by GitHub
parent 0e06be836c
commit a13b65422a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 70 additions and 103 deletions

View file

@ -6,7 +6,7 @@ import _ast
import tempfile
import types
from test import support
from test.support import script_helper
from test.support import script_helper, FakePath
class TestSpecifics(unittest.TestCase):
@ -663,13 +663,7 @@ if 1:
def test_path_like_objects(self):
# An implicit test for PyUnicode_FSDecoder().
class PathLike:
def __init__(self, path):
self._path = path
def __fspath__(self):
return self._path
compile("42", PathLike("test_compile_pathlike"), "single")
compile("42", FakePath("test_compile_pathlike"), "single")
def test_stack_overflow(self):
# bpo-31113: Stack overflow when compile a long sequence of