MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / _get_default_version

Function _get_default_version

tests/languages/python_test.py:40–63  ·  view source on GitHub ↗
(
        *,
        impl: str,
        exe: str,
        found: set[str],
        version: tuple[int, int],
)

Source from the content-addressed store, hash-verified

38
39
40def _get_default_version(
41 *,
42 impl: str,
43 exe: str,
44 found: set[str],
45 version: tuple[int, int],
46) -> str:
47 sys_exe = f'/fake/path/{exe}'
48 sys_impl = auto_namedtuple(name=impl)
49 sys_ver = auto_namedtuple(major=version[0], minor=version[1])
50
51 def find_exe(s):
52 if s in found:
53 return f'/fake/path/found/{exe}'
54 else:
55 return None
56
57 with (
58 mock.patch.object(sys, 'implementation', sys_impl),
59 mock.patch.object(sys, 'executable', sys_exe),
60 mock.patch.object(sys, 'version_info', sys_ver),
61 mock.patch.object(python, 'find_executable', find_exe),
62 ):
63 return python.get_default_version.__wrapped__()
64
65
66def test_default_version_sys_executable_found():

Calls 1

auto_namedtupleFunction · 0.90

Tested by

no test coverage detected