villebro commented on code in PR #21002:
URL: https://github.com/apache/superset/pull/21002#discussion_r943155044
##########
tests/unit_tests/pandas_postprocessing/test_contribution.py:
##########
@@ -74,7 +74,7 @@ def test_contribution():
rename_columns=["pct_a"],
)
assert processed_df.columns.tolist() == ["a", "b", "c", "pct_a"]
- assert_array_equal(processed_df["a"].tolist(), [1, 3, nan])
- assert_array_equal(processed_df["b"].tolist(), [1, 9, nan])
- assert_array_equal(processed_df["c"].tolist(), [nan, nan, nan])
+ assert_array_equal(processed_df["a"].tolist(), [1, 3, 0])
+ assert_array_equal(processed_df["b"].tolist(), [1, 9, 0])
+ assert_array_equal(processed_df["c"].tolist(), [0, 0, 0])
Review Comment:
I looked more closely at this, and I think this needs to be fixed. The test
is making sure that columns `a`, `b` and `c` are unchanged, and that the
contribution of `a` should be placed in a new column `pct_a`. Therefore this
would in fact count as a regression, as the original values should not be
mutated. So I would make sure the test does the following:
- these three assertions are unchanged
- add an additional assertion to make sure `pct_a` is in fact the correct
contribution. I expect it should be `[0.25, 0.75, 0]`
@EugeneTorap let me know if you need help with this.
--
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]