MCPcopy Create free account
hub / github.com/python/mypy / test_overload_signature

Method test_overload_signature

mypy/test/teststubtest.py:3164–3178  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3162 )
3163
3164 def test_overload_signature(self) -> None:
3165 # The same argument as both positional-only and pos-or-kw in
3166 # different overloads previously produced incorrect signatures
3167 source = """
3168 from typing import overload
3169 @overload
3170 def myfunction(arg: int) -> None: ...
3171 @overload
3172 def myfunction(arg: str, /) -> None: ...
3173 """
3174 result = build_helper(source)
3175 stub = result.files["__main__"].names["myfunction"].node
3176 assert isinstance(stub, nodes.OverloadedFuncDef)
3177 sig = mypy.stubtest.Signature.from_overloadedfuncdef(stub)
3178 assert str(sig) == "def (arg: int | str)"
3179
3180 def test_config_file(self) -> None:
3181 runtime = "temp = 5\n"

Callers

nothing calls this directly

Calls 4

build_helperFunction · 0.85
isinstanceFunction · 0.85
strClass · 0.85

Tested by

no test coverage detected