def test_same_number_of_parameters_but_one_is_default():
    g(5)
    g(<warning descr="Expected type 'int', got 'str' instead">"a"</warning>)

    g<warning descr="Unexpected type(s):(str, bool)Possible types:(int, str)(int, bool)">("a", False)</warning>
    g<warning descr="Unexpected type(s):(int, int)Possible types:(int, str)(int, bool)">(5, 6)</warning>
    g<warning descr="Unexpected type(s):(bool, int)Possible types:(int, str)(int, bool)">(False, 5)</warning>

    g(5, "a")
    g<warning descr="Unexpected type(s):(str, str)Possible types:(int, str)(int, bool)">("a", "b")</warning>
    g<warning descr="Unexpected type(s):(int, int)Possible types:(int, str)(int, bool)">(5, 6)</warning>
    g<warning descr="Unexpected type(s):(str, int)Possible types:(int, str)(int, bool)">("a", 5)</warning>
def test_same_number_of_parameters_but_one_is_default():
    g(5)
    g(<warning descr="Expected type 'int', got 'str' instead">"a"</warning>)

    g<warning descr="Unexpected type(s):(str, bool)Possible types:(int, str)(int, Optional[bool])">("a", False)</warning>
    g<warning descr="Unexpected type(s):(int, int)Possible types:(int, str)(int, Optional[bool])">(5, 6)</warning>
    g<warning descr="Unexpected type(s):(bool, int)Possible types:(int, str)(int, Optional[bool])">(False, 5)</warning>

    g(5, "a")
    g<warning descr="Unexpected type(s):(str, str)Possible types:(int, str)(int, Optional[bool])">("a", "b")</warning>
    g<warning descr="Unexpected type(s):(int, int)Possible types:(int, str)(int, Optional[bool])">(5, 6)</warning>
    g<warning descr="Unexpected type(s):(str, int)Possible types:(int, str)(int, Optional[bool])">("a", 5)</warning>
def tset_overloaded_generics(x):
    g(<warning descr="Expected type 'dict', got 'int' instead">Gen(10).get(10, 10)</warning>)
    g(Gen(10).get(10, <weak_warning descr="Expected type 'int' (matched generic type 'TypeVar('T')'), got 'str' instead">'foo'</weak_warning>))
    g(Gen('foo').get(10, <weak_warning descr="Expected type 'str' (matched generic type 'TypeVar('T')'), got 'int' instead">10</weak_warning>))
    g(<warning descr="Expected type 'dict', got 'str' instead">Gen('foo').get(10, 'foo')</warning>)
def test_overloaded_function(x):
    g(<warning descr="Expected type 'dict', got 'int' instead">f(10)</warning>)
    g(<warning descr="Expected type 'dict', got 'str' instead">f('foo')</warning>)
    g(<warning descr="Expected type 'dict', got 'Union[int, str]' instead">f(<warning descr="Expected type 'int', got 'Dict[int, int]' instead">{1: 2}</warning>)</warning>)
    g(<warning descr="Expected type 'dict', got 'Union[int, str]' instead">f(x)</warning>)
def test_stub_only_function(x):
    g(<warning descr="Expected type 'dict', got 'int' instead">stub_only(10)</warning>)
    g(<warning descr="Expected type 'dict', got 'str' instead">stub_only('foo')</warning>)
    g(<warning descr="Expected type 'dict', got 'Union[int, str]' instead">stub_only(x)</warning>)
    g(<warning descr="Expected type 'dict', got 'Union[int, str]' instead">stub_only(<warning descr="Expected type 'int', got 'Dict[int, int]' instead">{1: 2}</warning>)</warning>)
from m1 import g, Gen

g(<warning descr="Expected type 'dict', got 'int' instead">Gen(10).get(10, 10)</warning>)
g(Gen(10).get<warning descr="Unexpected type(s):(int, str)Possible types:(int, int)(str, int)">(10, 'foo')</warning>)
g(Gen('foo').get<warning descr="Unexpected type(s):(int, int)Possible types:(int, str)(str, str)">(10, 10)</warning>)
g(<warning descr="Expected type 'dict', got 'str' instead">Gen('foo').get(10, 'foo')</warning>)
Esempio n. 7
0
def test_overloaded_function(x):
    g(<warning descr="Expected type 'dict', got 'int' instead">f(10)</warning>)
    g(<warning descr="Expected type 'dict', got 'str' instead">f('foo')</warning>)
    g(<warning descr="Expected type 'dict', got 'Union[int, str]' instead">f(<warning descr="Unexpected type(s):(Dict[int, int])Possible types:(str)(int)">{1: 2}</warning>)</warning>)
    g(<warning descr="Expected type 'dict', got 'Union[int, str]' instead">f(x)</warning>)