|
7 | 7 |
|
8 | 8 | def test_select_implicit_int(pool: ydb.QuerySessionPool):
|
9 | 9 | expected_value = 111
|
10 |
| - res = pool.execute_with_retries(query, parameters={'$a': expected_value}) |
11 |
| - actual_value = res[0].rows[0]['value'] |
| 10 | + res = pool.execute_with_retries(query, parameters={"$a": expected_value}) |
| 11 | + actual_value = res[0].rows[0]["value"] |
12 | 12 | assert expected_value == actual_value
|
13 | 13 |
|
14 | 14 |
|
15 | 15 | def test_select_implicit_float(pool: ydb.QuerySessionPool):
|
16 | 16 | expected_value = 11.1
|
17 |
| - res = pool.execute_with_retries(query, parameters={'$a': expected_value}) |
18 |
| - actual_value = res[0].rows[0]['value'] |
| 17 | + res = pool.execute_with_retries(query, parameters={"$a": expected_value}) |
| 18 | + actual_value = res[0].rows[0]["value"] |
19 | 19 | assert expected_value == pytest.approx(actual_value)
|
20 | 20 |
|
21 | 21 |
|
22 | 22 | def test_select_implicit_bool(pool: ydb.QuerySessionPool):
|
23 | 23 | expected_value = False
|
24 |
| - res = pool.execute_with_retries(query, parameters={'$a': expected_value}) |
25 |
| - actual_value = res[0].rows[0]['value'] |
| 24 | + res = pool.execute_with_retries(query, parameters={"$a": expected_value}) |
| 25 | + actual_value = res[0].rows[0]["value"] |
26 | 26 | assert expected_value == actual_value
|
27 | 27 |
|
28 | 28 |
|
29 | 29 | def test_select_implicit_str(pool: ydb.QuerySessionPool):
|
30 | 30 | expected_value = "text"
|
31 |
| - res = pool.execute_with_retries(query, parameters={'$a': expected_value}) |
32 |
| - actual_value = res[0].rows[0]['value'] |
| 31 | + res = pool.execute_with_retries(query, parameters={"$a": expected_value}) |
| 32 | + actual_value = res[0].rows[0]["value"] |
| 33 | + assert expected_value == actual_value |
| 34 | + |
| 35 | + |
| 36 | +def test_select_implicit_list(pool: ydb.QuerySessionPool): |
| 37 | + expected_value = [1, 2, 3] |
| 38 | + res = pool.execute_with_retries(query, parameters={"$a": expected_value}) |
| 39 | + actual_value = res[0].rows[0]["value"] |
| 40 | + assert expected_value == actual_value |
| 41 | + |
| 42 | + |
| 43 | +def test_select_implicit_dict(pool: ydb.QuerySessionPool): |
| 44 | + expected_value = {"a": 1, "b": 2} |
| 45 | + res = pool.execute_with_retries(query, parameters={"$a": expected_value}) |
| 46 | + actual_value = res[0].rows[0]["value"] |
| 47 | + assert expected_value == actual_value |
| 48 | + |
| 49 | + |
| 50 | +def test_select_implicit_list_nested(pool: ydb.QuerySessionPool): |
| 51 | + expected_value = [{"a": 1}, {"b": 2}] |
| 52 | + res = pool.execute_with_retries(query, parameters={"$a": expected_value}) |
| 53 | + actual_value = res[0].rows[0]["value"] |
| 54 | + assert expected_value == actual_value |
| 55 | + |
| 56 | + |
| 57 | +def test_select_implicit_dict_nested(pool: ydb.QuerySessionPool): |
| 58 | + expected_value = {"a": [1, 2, 3], "b": [4, 5]} |
| 59 | + res = pool.execute_with_retries(query, parameters={"$a": expected_value}) |
| 60 | + actual_value = res[0].rows[0]["value"] |
33 | 61 | assert expected_value == actual_value
|
34 | 62 |
|
35 | 63 |
|
36 | 64 | def test_select_explicit_primitive(pool: ydb.QuerySessionPool):
|
37 | 65 | expected_value = 111
|
38 |
| - res = pool.execute_with_retries(query, parameters={'$a': (expected_value, ydb.PrimitiveType.Int64)}) |
39 |
| - actual_value = res[0].rows[0]['value'] |
| 66 | + res = pool.execute_with_retries(query, parameters={"$a": (expected_value, ydb.PrimitiveType.Int64)}) |
| 67 | + actual_value = res[0].rows[0]["value"] |
40 | 68 | assert expected_value == actual_value
|
41 | 69 |
|
42 | 70 |
|
43 | 71 | def test_select_explicit_list(pool: ydb.QuerySessionPool):
|
44 | 72 | expected_value = [1, 2, 3]
|
45 | 73 | type_ = ydb.ListType(ydb.PrimitiveType.Int64)
|
46 |
| - res = pool.execute_with_retries(query, parameters={'$a': (expected_value, type_)}) |
47 |
| - actual_value = res[0].rows[0]['value'] |
| 74 | + res = pool.execute_with_retries(query, parameters={"$a": (expected_value, type_)}) |
| 75 | + actual_value = res[0].rows[0]["value"] |
48 | 76 | assert expected_value == actual_value
|
49 | 77 |
|
50 | 78 |
|
51 | 79 | def test_select_explicit_dict(pool: ydb.QuerySessionPool):
|
52 |
| - expected_value = {'key': 'value'} |
| 80 | + expected_value = {"key": "value"} |
53 | 81 | type_ = ydb.DictType(ydb.PrimitiveType.Utf8, ydb.PrimitiveType.Utf8)
|
54 |
| - res = pool.execute_with_retries(query, parameters={'$a': (expected_value, type_)}) |
55 |
| - actual_value = res[0].rows[0]['value'] |
| 82 | + res = pool.execute_with_retries(query, parameters={"$a": (expected_value, type_)}) |
| 83 | + actual_value = res[0].rows[0]["value"] |
56 | 84 | assert expected_value == actual_value
|
0 commit comments