codeant-ai-for-open-source[bot] commented on code in PR #38689:
URL: https://github.com/apache/superset/pull/38689#discussion_r3612191408
##########
tests/unit_tests/models/helpers_test.py:
##########
@@ -3800,3 +3801,121 @@ def
test_like_filter_on_string_column_does_not_cast(database: Database) -> None:
assert not any(isinstance(node, Cast) for node in iterate(whereclause)), (
f"Unexpected Cast node in the filter expression: {whereclause}"
)
+
+
+def test_columns_by_name_verbose_overrides_column_name(database: Database) ->
None:
+ """
+ Test that verbose_name does NOT override existing column_name mapping.
+ """
Review Comment:
**Suggestion:** The test name says verbose names override column names, but
the assertions verify the opposite behavior; this contradictory naming is
misleading and can cause incorrect future maintenance or accidental inversion
of the expected behavior. Rename the test to match what it actually validates.
[inconsistent naming]
<details>
<summary><b>Severity Level:</b> Minor ๐งน</summary>
```mdx
- โ ๏ธ Test name misleads about expected column resolution.
- โ ๏ธ Future refactors may invert behavior by mistake.
- โ ๏ธ Developer understanding of filter resolution can be confused.
```
</details>
<details>
<summary><b>Steps of Reproduction โ
</b></summary>
```mdx
1. Open `tests/unit_tests/models/helpers_test.py` and locate
`test_columns_by_name_verbose_overrides_column_name` at lines `3806-3813`.
2. Read the docstring at `3807-3809`: "Test that verbose_name does NOT
override existing
column_name mapping." which states the opposite of what the function name
suggests.
3. Inspect the assertions at `3821-3823`, which verify that
`columns_by_name["sales"] ==
col2` and `columns_by_name["revenue"] == col1`, i.e., the real `column_name`
wins and
verbose_name does not override it.
4. Run the test suite (e.g., `pytest
tests/unit_tests/models/helpers_test.py`) and observe
that the test passes while asserting the "verbose_name does NOT override"
behavior; the
mismatch lies purely in naming, which can mislead future maintainers into
thinking the
intended behavior is that verbose_name should override column_name.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=853550d285444add913db7ed9081109a&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=853550d285444add913db7ed9081109a&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/models/helpers_test.py
**Line:** 3806:3809
**Comment:**
*Inconsistent Naming: The test name says verbose names override column
names, but the assertions verify the opposite behavior; this contradictory
naming is misleading and can cause incorrect future maintenance or accidental
inversion of the expected behavior. Rename the test to match what it actually
validates.
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%2F38689&comment_hash=4184388b65c4008bae7fcbb73faeaaf8df232f29bdc1870554fc1f19720d3e24&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38689&comment_hash=4184388b65c4008bae7fcbb73faeaaf8df232f29bdc1870554fc1f19720d3e24&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]