Changeset View
Changeset View
Standalone View
Standalone View
duchain/tests/pyduchaintest.cpp
Show First 20 Lines • Show All 937 Lines • ▼ Show 20 Line(s) | 884 | // QTest::newRow("funccall_dict") << "def foo(): return foo; checkme = foo();" << (uint) IntegralType::TypeFunction; | |||
---|---|---|---|---|---|
938 | 938 | | |||
939 | QTest::newRow("class_create_var") << "class c: pass\nd = c()\nd.foo = 3\ncheckme = d.foo" << "int"; | 939 | QTest::newRow("class_create_var") << "class c: pass\nd = c()\nd.foo = 3\ncheckme = d.foo" << "int"; | ||
940 | 940 | | |||
941 | QTest::newRow("tuple_loop") << "t = [(1, \"str\")]\nfor checkme, a in t: pass" << "int"; | 941 | QTest::newRow("tuple_loop") << "t = [(1, \"str\")]\nfor checkme, a in t: pass" << "int"; | ||
942 | 942 | | |||
943 | QTest::newRow("no_hints_type") << "def myfun(arg): arg = 3; return arg\ncheckme = myfun(3)" << "int"; | 943 | QTest::newRow("no_hints_type") << "def myfun(arg): arg = 3; return arg\ncheckme = myfun(3)" << "int"; | ||
944 | QTest::newRow("hints_type") << "def myfun(arg): return arg\ncheckme = myfun(3)" << "int"; | 944 | QTest::newRow("hints_type") << "def myfun(arg): return arg\ncheckme = myfun(3)" << "int"; | ||
945 | QTest::newRow("args_type") << "def myfun(*args): return args[0]\ncheckme = myfun(3)" << "int"; | 945 | QTest::newRow("args_type") << "def myfun(*args): return args[0]\ncheckme = myfun(3)" << "int"; | ||
946 | QTest::newRow("kwarg_type") << "def myfun(**args): return args['a']\ncheckme = myfun(a=3)" << "int"; | 946 | QTest::newRow("kwarg_type") << "def myfun(**kwargs): return kwargs['a']\ncheckme = myfun(a=3)" << "int"; | ||
947 | QTest::newRow("dict_kwarg_type") << "def foo(**kwargs): return kwargs['']\ncheckme = foo(**{'a': 12})" << "int"; | ||||
948 | QTest::newRow("dict_norm_kwarg_type") << "def foo(**kwargs): return kwargs['']\n" | ||||
949 | "checkme = foo(**{'a': 12}, b=1.2)" << "unsure (int, float)"; | ||||
950 | QTest::newRow("multi_dict_kwarg_type") << "def foo(**kwargs): return kwargs['']\n" | ||||
951 | "checkme = foo(**{'a': 12}, b=1.2, **{'c': ''})" << "unsure (int, float, str)"; | ||||
947 | QTest::newRow("named_arg_type") << "def myfun(arg): return arg\ncheckme = myfun(arg=3)" << "int"; | 952 | QTest::newRow("named_arg_type") << "def myfun(arg): return arg\ncheckme = myfun(arg=3)" << "int"; | ||
953 | | ||||
948 | QTest::newRow("arg_args_type") << "def myfun(arg, *args): return args[0]\n" | 954 | QTest::newRow("arg_args_type") << "def myfun(arg, *args): return args[0]\n" | ||
949 | "checkme = myfun(3, str())" << "str"; | 955 | "checkme = myfun(3, str())" << "str"; | ||
950 | QTest::newRow("arg_kwargs_type") << "def myfun(arg, **kwargs): return kwargs['a']\n" | 956 | QTest::newRow("arg_kwargs_type") << "def myfun(arg, **kwargs): return kwargs['a']\n" | ||
951 | "checkme = myfun(12, a=str())" << "str"; | 957 | "checkme = myfun(12, a=str())" << "str"; | ||
952 | QTest::newRow("named_kwargs_type_1") << "def myfun(arg, **kwargs): return arg\n" | 958 | QTest::newRow("named_kwargs_type_1") << "def myfun(arg, **kwargs): return arg\n" | ||
953 | "checkme = myfun(arg=12, a=str())" << "int"; | 959 | "checkme = myfun(arg=12, a=str())" << "int"; | ||
954 | QTest::newRow("named_kwargs_type_2") << "def myfun(arg, **kwargs): return kwargs['a']\n" | 960 | QTest::newRow("named_kwargs_type_2") << "def myfun(arg, **kwargs): return kwargs['a']\n" | ||
955 | "checkme = myfun(arg=12, a=str())" << "str"; | 961 | "checkme = myfun(arg=12, a=str())" << "str"; | ||
▲ Show 20 Lines • Show All 660 Lines • Show Last 20 Lines |