codeant-ai-for-open-source[bot] commented on code in PR #40775:
URL: https://github.com/apache/superset/pull/40775#discussion_r3405680978
##########
tests/unit_tests/mcp_service/chart/test_big_number_chart.py:
##########
@@ -307,6 +348,49 @@ def test_no_trendline_fields_for_total(self) -> None:
assert "time_grain_sqla" not in form_data
assert "start_y_axis_at_zero" not in form_data
+ def test_with_aggregation_sum(self) -> None:
+ config = BigNumberChartConfig(
+ chart_type="big_number",
+ metric=ColumnRef(name="revenue", aggregate="SUM"),
+ temporal_column="order_date",
+ show_trendline=True,
+ aggregation="sum",
+ )
+ form_data = map_big_number_config(config)
+ assert form_data["aggregation"] == "sum"
Review Comment:
**Suggestion:** Add a short docstring to this newly added test method so it
complies with the rule requiring documentation for new functions. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This is a newly added test function and it does not include a docstring in
the final file state.
The custom rule requires newly added Python functions and classes to be
documented inline, so the suggestion is valid.
</details>
[Fix in
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=feb4a88ddf164699a875f1d5c0be77ed&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
| [Fix in VSCode
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=feb4a88ddf164699a875f1d5c0be77ed&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** tests/unit_tests/mcp_service/chart/test_big_number_chart.py
**Line:** 351:360
**Comment:**
*Custom Rule: Add a short docstring to this newly added test method so
it complies with the rule requiring documentation for new functions.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40775&comment_hash=234b850b7294e4d3d13861ddfd625c80b0cf7a8cf423f2e6ba54abe9d00df8c0&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40775&comment_hash=234b850b7294e4d3d13861ddfd625c80b0cf7a8cf423f2e6ba54abe9d00df8c0&reaction=dislike'>👎</a>
##########
tests/unit_tests/mcp_service/chart/test_big_number_chart.py:
##########
@@ -307,6 +348,49 @@ def test_no_trendline_fields_for_total(self) -> None:
assert "time_grain_sqla" not in form_data
assert "start_y_axis_at_zero" not in form_data
+ def test_with_aggregation_sum(self) -> None:
+ config = BigNumberChartConfig(
+ chart_type="big_number",
+ metric=ColumnRef(name="revenue", aggregate="SUM"),
+ temporal_column="order_date",
+ show_trendline=True,
+ aggregation="sum",
+ )
+ form_data = map_big_number_config(config)
+ assert form_data["aggregation"] == "sum"
+
+ def test_with_aggregation_last_value(self) -> None:
+ config = BigNumberChartConfig(
+ chart_type="big_number",
+ metric=ColumnRef(name="revenue", aggregate="SUM"),
+ temporal_column="order_date",
+ show_trendline=True,
+ aggregation="LAST_VALUE",
+ )
+ form_data = map_big_number_config(config)
+ assert form_data["aggregation"] == "LAST_VALUE"
+
+ def test_aggregation_absent_when_not_set(self) -> None:
+ config = BigNumberChartConfig(
+ chart_type="big_number",
+ metric=ColumnRef(name="revenue", aggregate="SUM"),
+ temporal_column="order_date",
+ show_trendline=True,
+ )
+ form_data = map_big_number_config(config)
+ assert "aggregation" not in form_data
Review Comment:
**Suggestion:** Include a concise docstring for this newly added test method
to align with the rule that new functions must be documented. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This is another newly added test function without a docstring.
It matches the custom rule requiring newly added Python functions to be
documented inline.
</details>
[Fix in
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=69c8f84bc30e44bb9efba99c51e23080&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
| [Fix in VSCode
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=69c8f84bc30e44bb9efba99c51e23080&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** tests/unit_tests/mcp_service/chart/test_big_number_chart.py
**Line:** 373:381
**Comment:**
*Custom Rule: Include a concise docstring for this newly added test
method to align with the rule that new functions must be documented.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40775&comment_hash=871abfaa1107207ed9a9f648f52765715b1d6c51e85d7547cb78f31a083f6d39&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40775&comment_hash=871abfaa1107207ed9a9f648f52765715b1d6c51e85d7547cb78f31a083f6d39&reaction=dislike'>👎</a>
##########
tests/unit_tests/mcp_service/chart/test_big_number_chart.py:
##########
@@ -307,6 +348,49 @@ def test_no_trendline_fields_for_total(self) -> None:
assert "time_grain_sqla" not in form_data
assert "start_y_axis_at_zero" not in form_data
+ def test_with_aggregation_sum(self) -> None:
+ config = BigNumberChartConfig(
+ chart_type="big_number",
+ metric=ColumnRef(name="revenue", aggregate="SUM"),
+ temporal_column="order_date",
+ show_trendline=True,
+ aggregation="sum",
+ )
+ form_data = map_big_number_config(config)
+ assert form_data["aggregation"] == "sum"
+
+ def test_with_aggregation_last_value(self) -> None:
+ config = BigNumberChartConfig(
+ chart_type="big_number",
+ metric=ColumnRef(name="revenue", aggregate="SUM"),
+ temporal_column="order_date",
+ show_trendline=True,
+ aggregation="LAST_VALUE",
+ )
+ form_data = map_big_number_config(config)
+ assert form_data["aggregation"] == "LAST_VALUE"
Review Comment:
**Suggestion:** Add an inline docstring to this new test method to satisfy
the docstring requirement for newly introduced functions. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This newly introduced function lacks a docstring in the current file.
Since the rule explicitly requires docstrings for new Python functions, the
violation is real.
</details>
[Fix in
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ba88174e23b446b995fe99a6f2a56f03&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
| [Fix in VSCode
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=ba88174e23b446b995fe99a6f2a56f03&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** tests/unit_tests/mcp_service/chart/test_big_number_chart.py
**Line:** 362:371
**Comment:**
*Custom Rule: Add an inline docstring to this new test method to
satisfy the docstring requirement for newly introduced functions.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40775&comment_hash=80494189d2b7299270ebbc512e0f202ebc6845f8dbf465840f3ef8b4b5dd391e&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40775&comment_hash=80494189d2b7299270ebbc512e0f202ebc6845f8dbf465840f3ef8b4b5dd391e&reaction=dislike'>👎</a>
--
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]