Changeset View
Changeset View
Standalone View
Standalone View
duchain/tests/pyduchaintest.cpp
Context not available. | |||||
861 | QTest::newRow("tuple_simple2") << "mytuple = 3, 5.5\nfoobar, checkme = mytuple" << "float"; | 861 | QTest::newRow("tuple_simple2") << "mytuple = 3, 5.5\nfoobar, checkme = mytuple" << "float"; | ||
---|---|---|---|---|---|
862 | QTest::newRow("tuple_simple3") << "mytuple = 3, 5.5, \"str\", 3, \"str\"\na, b, c, d, checkme = mytuple" << "str"; | 862 | QTest::newRow("tuple_simple3") << "mytuple = 3, 5.5, \"str\", 3, \"str\"\na, b, c, d, checkme = mytuple" << "str"; | ||
863 | 863 | | |||
864 | QTest::newRow("tuple_single") << "checkme = 4," << "tuple"; | ||||
865 | QTest::newRow("tuple_single2") << "checkme, = 4," << "int"; | ||||
866 | QTest::newRow("tuple_single3") << "mytuple = 4,\ncheckme, = mytuple" << "int"; | ||||
867 | | ||||
868 | QTest::newRow("tuple_ext_unpack") << "mytuple = 3, 5.5\nfoobar, *starred, checkme = mytuple" << "float"; | ||||
869 | QTest::newRow("tuple_ext_unpack2") << "mytuple = 3, 5.5\nfoobar, *checkme, another = mytuple" << "list"; | ||||
870 | QTest::newRow("tuple_ext_unpack3") << "mytuple = 3, 5.5\nfoobar, *checkme = mytuple" << "list of float"; | ||||
871 | QTest::newRow("tuple_ext_unpack4") << "mytuple = 3, 5.5\n*checkme, = mytuple" << "list of unsure (int, float)"; | ||||
872 | | ||||
873 | QTest::newRow("tuple_nested") << "mytuple = 3, ('foo', 5.5)\ncheckme, foobar = mytuple" << "int"; | ||||
874 | QTest::newRow("tuple_nested2") << "mytuple = 3, ('foo', 5.5)\nfoobar, (checkme, other) = mytuple" << "str"; | ||||
875 | QTest::newRow("tuple_nested3") << "mytuple = ((7, 'foo'), 5.5), 3\n((baz, checkme), other), foo = mytuple" << "str"; | ||||
876 | | ||||
877 | // This isn't actually defined behaviour, but it works in CPython, so people use it... | ||||
878 | QTest::newRow("tuple_nested_ext") << "mytuple = (2, ('foo', 'bar', 6), 7)\na, (b, *checkme, c), *d = mytuple" << "list of str"; | ||||
879 | | ||||
880 | QTest::newRow("tuple_multi_assign") << "mytuple = 2, 'foo'\ncheckme = a = mytuple" << "tuple"; | ||||
881 | QTest::newRow("tuple_multi_assign2") << "mytuple = 2, 'foo'\ncheckme, a = b = mytuple" << "int"; | ||||
882 | | ||||
883 | QTest::newRow("list_unpack") << "mylist = [1, 2, 3]\ncheckme, b, c = mylist" << "int"; | ||||
884 | QTest::newRow("list_unpack2") << "mylist = [1, 'x', 3]\ncheckme, b, c = mylist" << "unsure (int, str)"; | ||||
885 | | ||||
886 | QTest::newRow("list_ext_unpack") << "mylist = [1, 2, 3]\n*checkme, foo = mylist" << "list of int"; | ||||
887 | QTest::newRow("list_ext_unpack2") << "mylist = [1, 'x', 3]\n*checkme, foo = mylist" << "list of unsure (int, str)"; | ||||
888 | | ||||
864 | QTest::newRow("if_expr_sure") << "checkme = 3 if 7 > 9 else 5" << "int"; | 889 | QTest::newRow("if_expr_sure") << "checkme = 3 if 7 > 9 else 5" << "int"; | ||
865 | 890 | | |||
866 | QTest::newRow("unary_op") << "checkme = -42" << "int"; | 891 | QTest::newRow("unary_op") << "checkme = -42" << "int"; | ||
Context not available. |