codeant-ai-for-open-source[bot] commented on code in PR #39973:
URL: https://github.com/apache/superset/pull/39973#discussion_r3573673883
##########
tests/unit_tests/commands/report/execute_test.py:
##########
@@ -2359,3 +2359,32 @@ def
test_get_dashboard_urls_raises_when_target_dashboard_soft_deleted(
state = BaseReportState(report_schedule, datetime.utcnow(), uuid4())
with pytest.raises(ReportScheduleTargetDashboardDeletedError):
state.get_dashboard_urls()
+
+
+def test_get_url_raises_unexpected_error_when_target_is_missing(
+ mocker: MockerFixture,
+ app: SupersetApp,
+) -> None:
+ """A malformed schedule without either target raises a useful error."""
+ mock_report_schedule: ReportSchedule = mocker.Mock(spec=ReportSchedule)
+ mock_report_schedule.id = 42
+ mock_report_schedule.name = "orphan_report"
+ mock_report_schedule.chart = None
+ mock_report_schedule.chart_id = None
+ mock_report_schedule.dashboard = None
+ mock_report_schedule.dashboard_id = None
+ mock_report_schedule.force_screenshot = False
+
+ class_instance: BaseReportState = BaseReportState(
+ mock_report_schedule, "January 1, 2021", "execution_id_example"
+ )
+ class_instance._report_schedule = mock_report_schedule
+
+ with pytest.raises(ReportScheduleUnexpectedError) as excinfo:
+ class_instance._get_url()
+
+ message = str(excinfo.value)
Review Comment:
**Suggestion:** Add an explicit type annotation for this newly introduced
local variable to comply with the type-hint requirement for relevant variables.
[custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
The new local variable `message` is introduced without an explicit type
annotation, and it can clearly be annotated as `str` under the type-hint rule
for relevant variables.
</details>
<details>
<summary><b>Rule source ๐ </b></summary>
.cursor/rules/dev-standard.mdc (line 28)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=5821064816d549e5b8ab3b8e58b80820&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=5821064816d549e5b8ab3b8e58b80820&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/commands/report/execute_test.py
**Line:** 2386:2386
**Comment:**
*Custom Rule: Add an explicit type annotation for this newly introduced
local variable to comply with the type-hint requirement for relevant variables.
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%2F39973&comment_hash=98820ec2b9f1e81709592fb257a9904970ef56156c6218f9559d68d92f0a4cac&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39973&comment_hash=98820ec2b9f1e81709592fb257a9904970ef56156c6218f9559d68d92f0a4cac&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]