@@ -61,6 +61,27 @@ def test_select_implicit_dict_nested(pool: ydb.QuerySessionPool):
61
61
assert expected_value == actual_value
62
62
63
63
64
+ def test_select_implicit_custom_type_raises (pool : ydb .QuerySessionPool ):
65
+ class CustomClass :
66
+ pass
67
+
68
+ expected_value = CustomClass ()
69
+ with pytest .raises (ValueError ):
70
+ pool .execute_with_retries (query , parameters = {"$a" : expected_value })
71
+
72
+
73
+ def test_select_implicit_empty_list_raises (pool : ydb .QuerySessionPool ):
74
+ expected_value = []
75
+ with pytest .raises (ValueError ):
76
+ pool .execute_with_retries (query , parameters = {"$a" : expected_value })
77
+
78
+
79
+ def test_select_implicit_empty_dict_raises (pool : ydb .QuerySessionPool ):
80
+ expected_value = {}
81
+ with pytest .raises (ValueError ):
82
+ pool .execute_with_retries (query , parameters = {"$a" : expected_value })
83
+
84
+
64
85
def test_select_explicit_primitive (pool : ydb .QuerySessionPool ):
65
86
expected_value = 111
66
87
res = pool .execute_with_retries (query , parameters = {"$a" : (expected_value , ydb .PrimitiveType .Int64 )})
@@ -82,3 +103,44 @@ def test_select_explicit_dict(pool: ydb.QuerySessionPool):
82
103
res = pool .execute_with_retries (query , parameters = {"$a" : (expected_value , type_ )})
83
104
actual_value = res [0 ].rows [0 ]["value" ]
84
105
assert expected_value == actual_value
106
+
107
+
108
+ def test_select_explicit_empty_list_not_raises (pool : ydb .QuerySessionPool ):
109
+ expected_value = []
110
+ type_ = ydb .ListType (ydb .PrimitiveType .Int64 )
111
+ res = pool .execute_with_retries (query , parameters = {"$a" : (expected_value , type_ )})
112
+ actual_value = res [0 ].rows [0 ]["value" ]
113
+ assert expected_value == actual_value
114
+
115
+
116
+ def test_select_explicit_empty_dict_not_raises (pool : ydb .QuerySessionPool ):
117
+ expected_value = {}
118
+ type_ = ydb .DictType (ydb .PrimitiveType .Utf8 , ydb .PrimitiveType .Utf8 )
119
+ res = pool .execute_with_retries (query , parameters = {"$a" : (expected_value , type_ )})
120
+ actual_value = res [0 ].rows [0 ]["value" ]
121
+ assert expected_value == actual_value
122
+
123
+
124
+ def test_select_typedvalue_full_primitive (pool : ydb .QuerySessionPool ):
125
+ expected_value = 111
126
+ typed_value = ydb .TypedValue (expected_value , ydb .PrimitiveType .Int64 )
127
+ res = pool .execute_with_retries (query , parameters = {"$a" : typed_value })
128
+ actual_value = res [0 ].rows [0 ]["value" ]
129
+ assert expected_value == actual_value
130
+
131
+
132
+ def test_select_typedvalue_implicit_primitive (pool : ydb .QuerySessionPool ):
133
+ expected_value = 111
134
+ typed_value = ydb .TypedValue (expected_value )
135
+ res = pool .execute_with_retries (query , parameters = {"$a" : typed_value })
136
+ actual_value = res [0 ].rows [0 ]["value" ]
137
+ assert expected_value == actual_value
138
+
139
+ def test_select_typevalue_custom_type_raises (pool : ydb .QuerySessionPool ):
140
+ class CustomClass :
141
+ pass
142
+
143
+ expected_value = CustomClass ()
144
+ typed_value = ydb .TypedValue (expected_value )
145
+ with pytest .raises (ValueError ):
146
+ pool .execute_with_retries (query , parameters = {"$a" : typed_value })
0 commit comments