File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ import uuid
2
+
1
3
import pytest
2
4
import ydb
3
5
@@ -152,3 +154,27 @@ class CustomClass:
152
154
typed_value = ydb .TypedValue (expected_value )
153
155
with pytest .raises (ValueError ):
154
156
pool .execute_with_retries (query , parameters = {"$a" : typed_value })
157
+
158
+
159
+ def test_uuid_send (pool : ydb .QuerySessionPool ):
160
+ val = uuid .UUID ("6E73B41C-4EDE-4D08-9CFB-B7462D9E498B" )
161
+ query = """
162
+ DECLARE $val AS UUID;
163
+
164
+ SELECT CAST($val AS Utf8) AS value
165
+ """
166
+ res = pool .execute_with_retries (query , parameters = {"$val" : ydb .TypedValue (val , ydb .PrimitiveType .UUID )})
167
+ actual_value = res [0 ].rows [0 ]["value" ]
168
+ assert actual_value .upper () == str (val ).upper ()
169
+
170
+
171
+ def test_uuid_read (pool : ydb .QuerySessionPool ):
172
+ val = uuid .UUID ("6E73B41C-4EDE-4D08-9CFB-B7462D9E498B" )
173
+ query = """
174
+ DECLARE $val AS Utf8;
175
+
176
+ SELECT CAST($val AS UUID) AS value
177
+ """
178
+ res = pool .execute_with_retries (query , parameters = {"$val" : ydb .TypedValue (str (val ), ydb .PrimitiveType .Utf8 )})
179
+ actual_value = res [0 ].rows [0 ]["value" ]
180
+ assert actual_value .hex .upper () == val .hex .upper ()
You can’t perform that action at this time.
0 commit comments