summaryrefslogtreecommitdiffstats
path: root/yql/essentials/udfs/common/python/bindings/py_cast_ut.cpp
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2025-07-24 21:46:28 +0300
committerrobot-piglet <[email protected]>2025-07-24 21:58:13 +0300
commit475c997f5ded6c9025b31345e894afb2fd00de27 (patch)
tree1be88f3ae818b4b9c5d2d3350a44e88a6d57b250 /yql/essentials/udfs/common/python/bindings/py_cast_ut.cpp
parentaac2e8a24f54055971d7291453001b440a0be98c (diff)
Intermediate changes
commit_hash:4b0cad6620396d4b5422b264f4aa162104d45e8d
Diffstat (limited to 'yql/essentials/udfs/common/python/bindings/py_cast_ut.cpp')
-rw-r--r--yql/essentials/udfs/common/python/bindings/py_cast_ut.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/yql/essentials/udfs/common/python/bindings/py_cast_ut.cpp b/yql/essentials/udfs/common/python/bindings/py_cast_ut.cpp
index d4ee90278c2..3c6514aea02 100644
--- a/yql/essentials/udfs/common/python/bindings/py_cast_ut.cpp
+++ b/yql/essentials/udfs/common/python/bindings/py_cast_ut.cpp
@@ -124,4 +124,29 @@ Y_UNIT_TEST_SUITE(TPyCastTest) {
Y_UNIT_TEST(BadFromPythonJson) {
TestBadUtf8Encode<NUdf::TJson>();
}
+
+ Y_UNIT_TEST(BadToPythonJson) {
+ TPythonTestEngine engine;
+ UNIT_ASSERT_EXCEPTION_CONTAINS(
+ engine.UnsafeCall<void(NUdf::TJson)>(
+ [](const TType*, const NUdf::IValueBuilder& builder) {
+ // XXX: The value below is built with the
+ // following expression:
+ // $query = "a=1&t%EDb=2";
+ // $qdict = Url::QueryStringToDict($query);
+ // $qyson = Yson::From($qdict);
+ // $badJson = Yson::SerializeJson($qyson);
+ //
+ // For more info, see YQL-20231 and YQL-20220.
+ constexpr TStringBuf badJson = "\x7b\x22\x61\x22\x3a\x5b\x22\x31\x22\x5d\x2c\x22\x74\xed\x62\x22\x3a\x5b\x22\x32\x22\x5d\x7d";
+ return builder.NewString(badJson);
+ },
+ "def Test(arg):\n"
+ " pass",
+ [](const NUdf::TUnboxedValuePod&) {
+ Y_UNREACHABLE();
+ }
+ ),
+ yexception, "Failed to export Json given as args[0]");
+ }
} // Y_UNIT_TEST_SUITE(TPyCastTest)