codeant-ai-for-open-source[bot] commented on code in PR #42619:
URL: https://github.com/apache/superset/pull/42619#discussion_r3691481031
##########
tests/unit_tests/utils/map_type_tests.py:
##########
@@ -42,9 +42,9 @@ def test_column_with_invalid_operation():
metric = SqlMetric(metric_name="my_column",
expression="INVALID(my_column)")
datasource = MagicMock(metrics=[metric])
column = "my_column"
- with patch("superset.utils.core.logger.warning") as mock_warning:
+ with patch("superset.utils.core.logger.debug") as mock_debug:
assert (get_metric_type_from_column(column, datasource)) == ""
- mock_warning.assert_called_once()
+ mock_debug.assert_called_once()
Review Comment:
**Suggestion:** The assertion verifies only that `logger.debug` was called,
so the test would still pass if the implementation logged the wrong message or
omitted the invalid metric expression. Assert the expected message and
expression arguments to protect the diagnostic contract introduced by this
change. [code quality]
<details>
<summary><b>Severity Level:</b> Minor ๐งน</summary>
```mdx
- โ ๏ธ Debug-log regressions can pass unit tests unnoticed.
- โ ๏ธ Invalid metric diagnostics may lose their expression context.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=dd5425c392d24c1fa4b2c17b3ac56acc&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=dd5425c392d24c1fa4b2c17b3ac56acc&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/utils/map_type_tests.py
**Line:** 47:47
**Comment:**
*Code Quality: The assertion verifies only that `logger.debug` was
called, so the test would still pass if the implementation logged the wrong
message or omitted the invalid metric expression. Assert the expected message
and expression arguments to protect the diagnostic contract introduced by this
change.
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%2F42619&comment_hash=b24153f21e3ae4ac76bb20a860d662bd17bf7e01bbf17cc6697586eb4f59a6b2&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42619&comment_hash=b24153f21e3ae4ac76bb20a860d662bd17bf7e01bbf17cc6697586eb4f59a6b2&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]