aminghadersohi commented on code in PR #40456:
URL: https://github.com/apache/superset/pull/40456#discussion_r4002426927
##########
tests/unit_tests/pandas_postprocessing/test_histogram.py:
##########
@@ -207,3 +207,13 @@ def test_histogram_with_no_groupby_and_all_null_values():
result = histogram(data_with_no_groupby_and_all_nulls, "a", [], bins)
assert result.empty
+
+
+def test_histogram_no_setting_with_copy_warning():
+ import warnings
+ from pandas.errors import SettingWithCopyWarning
+ source = DataFrame({"a": [1, 2, None, 4, 5], "b": list(range(5))})
+ with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter("always")
+ histogram(source.loc[source["b"] >= 0], "a", [], 3)
Review Comment:
Verified at this head: your suggested fixture (`sliced = source[source["b"]
> 0]`) still passes with `.copy()` removed. #36605 moved the write site to
`df.loc[:, column] =`, which no longer trips the check, so no fixture can make
this test fail without `.copy()`.
--
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]