Upgrade typeshed

This commit is contained in:
Dave Halter
2021-01-01 03:18:49 +01:00
parent 92d96ac336
commit d821451a64
11 changed files with 36 additions and 44 deletions

View File

@@ -15,4 +15,4 @@ def test_module__file__(Script, environment):
def_, = Script('import antigravity; antigravity.__file__').infer()
value = def_._name._value.get_safe_value()
assert value.endswith('.py')
assert value.endswith('.pyi')

View File

@@ -21,10 +21,10 @@ def test_get_typeshed_directories():
def transform(set_):
return {x.replace('/', os.path.sep) for x in set_}
dirs = get_dirs(PythonVersionInfo(3, 6))
assert dirs == transform({'stdlib/2and3', 'stdlib/3',
'stdlib/3.6', 'third_party/2and3',
'third_party/3', 'third_party/3.6'})
dirs = get_dirs(PythonVersionInfo(3, 7))
assert dirs == transform({'stdlib/2and3', 'stdlib/3', 'stdlib/3.7',
'third_party/2and3',
'third_party/3', 'third_party/3.7'})
def test_get_stub_files():
@@ -92,7 +92,7 @@ def test_sys_exc_info(Script):
# It's an optional.
assert def_.name == 'BaseException'
assert def_.module_path == typeshed.TYPESHED_PATH.joinpath(
'stdlib', '2and3', 'builtins.pyi'
'stdlib', '3', 'builtins.pyi'
)
assert def_.type == 'instance'
assert none.name == 'NoneType'

View File

@@ -227,14 +227,22 @@ def test_nested_signatures(Script, environment, combination, expected):
assert expected == computed
def test_pow_signature(Script):
def test_pow_signature(Script, environment):
# See github #1357
sigs = Script('pow(').get_signatures()
strings = {sig.to_string() for sig in sigs}
assert strings == {'pow(x: float, y: float, z: float, /) -> float',
'pow(x: float, y: float, /) -> float',
'pow(x: int, y: int, z: int, /) -> Any',
'pow(x: int, y: int, /) -> Any'}
if environment.version_info < (3, 8):
assert strings == {'pow(base: _SupportsPow2[_E, _T_co], exp: _E, /) -> _T_co',
'pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M, /) -> _T_co',
'pow(base: float, exp: float, mod: None=..., /) -> float',
'pow(base: int, exp: int, mod: None=..., /) -> Any',
'pow(base: int, exp: int, mod: int, /) -> int'}
else:
assert strings == {'pow(base: _SupportsPow2[_E, _T_co], exp: _E) -> _T_co',
'pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M) -> _T_co',
'pow(base: float, exp: float, mod: None=...) -> float',
'pow(base: int, exp: int, mod: None=...) -> Any',
'pow(base: int, exp: int, mod: int) -> int'}
@pytest.mark.parametrize(