rusackas commented on code in PR #41533:
URL: https://github.com/apache/superset/pull/41533#discussion_r3493935315


##########
tests/unit_tests/utils/json_tests.py:
##########
@@ -415,3 +415,17 @@ def test_format_timedelta():
         json.format_timedelta(timedelta(0) - timedelta(days=16, hours=4, 
minutes=3))
         == "-16 days, 4:03:00"
     )
+
+
+def test_dumps_escapes_non_ascii_by_default():

Review Comment:
   Good call — added `-> None` to both new tests to match the rest of the PR.



##########
tests/unit_tests/result_set_test.py:
##########
@@ -522,6 +522,37 @@ def 
test_clickhouse_json_column_in_pa_table_is_valid_json() -> None:
     assert parsed1 == {"e": 5}
 
 
+def test_stringify_values_preserves_non_ascii_characters() -> None:
+    """
+    Non-ASCII text inside array/struct/JSON column values (e.g. the Cyrillic 
and
+    CJK strings produced by ``array_agg``) must render verbatim in the result
+    grid, not as ``\\uXXXX`` escape sequences. Regression test for #19388 and
+    #22904, where such values were displayed as "unicode gibberish".
+    """
+    data = np.array(
+        [
+            ["Лонгсливы", "Свитшоты"],
+            {"city": "北京", "country": "中国"},
+            "你好,世界!",
+        ],
+        dtype=object,
+    )

Review Comment:
   We don't annotate local variables in tests here — the type-hint convention 
is for function signatures, which this one already has.



##########
tests/unit_tests/result_set_test.py:
##########
@@ -522,6 +522,37 @@ def 
test_clickhouse_json_column_in_pa_table_is_valid_json() -> None:
     assert parsed1 == {"e": 5}
 
 
+def test_stringify_values_preserves_non_ascii_characters() -> None:
+    """
+    Non-ASCII text inside array/struct/JSON column values (e.g. the Cyrillic 
and
+    CJK strings produced by ``array_agg``) must render verbatim in the result
+    grid, not as ``\\uXXXX`` escape sequences. Regression test for #19388 and
+    #22904, where such values were displayed as "unicode gibberish".
+    """
+    data = np.array(
+        [
+            ["Лонгсливы", "Свитшоты"],
+            {"city": "北京", "country": "中国"},
+            "你好,世界!",
+        ],
+        dtype=object,
+    )
+    result = stringify_values(data)

Review Comment:
   Same as the other thread — local variables in tests aren't annotated in this 
codebase, so leaving this as-is.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to