Cloud-Architect-Emma commented on code in PR #40190:
URL: https://github.com/apache/superset/pull/40190#discussion_r3297104872


##########
tests/unit_tests/common/test_dataframe_utils.py:
##########
@@ -48,3 +49,27 @@ def test_is_datetime_series():
             datetime.datetime(2018, 1, 1), datetime.datetime(2018, 2, 1)
         ).to_series()
     )
+
+
+def test_df_metrics_to_num_converts_string_numerics():
+    """Test that string-encoded numeric columns (e.g. from ClickHouse) are 
converted."""
+    query_object = MagicMock()
+    query_object.metric_names = ["sum_col", "mixed_col", "text_col"]
+    df = pd.DataFrame(
+        {
+            "sum_col": pd.array(["100", "200", "300"], dtype=object),
+            "mixed_col": pd.array(["1", "not_a_number", "3"], dtype=object),
+            "text_col": pd.array(["foo", "bar", "baz"], dtype=object),
+            "dim_col": pd.array(["a", "b", "c"], dtype=object),

Review Comment:
   add tests\unit_tests\common\test_dataframe_utils.py



-- 
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