bito-code-review[bot] commented on PR #40456:
URL: https://github.com/apache/superset/pull/40456#issuecomment-4605614842

   <!-- Bito Reply -->
   The observation is correct. The existing tests in `test_histogram.py` do not 
trigger the `SettingWithCopyWarning` because they use newly constructed 
DataFrames, which do not have the `_is_copy` attribute set. Adding a test case 
that uses a sliced DataFrame, as suggested, is necessary to verify that the 
warning is effectively suppressed in the intended scenarios.
   
   **superset/utils/pandas_postprocessing/histogram.py**
   ```
   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)
       assert not any(issubclass(x.category, SettingWithCopyWarning) for x in w)
   ```


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