codeant-ai-for-open-source[bot] commented on code in PR #39294:
URL: https://github.com/apache/superset/pull/39294#discussion_r3465763704
##########
tests/unit_tests/utils/test_file.py:
##########
@@ -34,10 +34,30 @@
("你好", 475, True, "475"),
("Energy Sankey 你好", 475, False, "Energy_Sankey_475"),
("Energy Sankey 你好", 475, True, "Energy_Sankey"),
+ ("Energy\x08Sankey", 132, False, "EnergySankey_132"),
+ ("Energy\x08Sankey", 132, True, "EnergySankey"),
+ ("Sales\x7fReport", 1, False, "SalesReport_1"),
],
)
def test_get_filename(
model_name: str, model_id: int, skip_id: bool, expected_filename: str
) -> None:
original_filename = get_filename(model_name, model_id, skip_id)
assert expected_filename == original_filename
+
+
[email protected](
+ ("raw", "expected"),
+ [
+ ("normal", "normal"),
+ ("a\x08b", "ab"),
+ ("x\x09y", "xy"),
+ ("x\ny", "xy"),
+ ("x\ry", "xy"),
+ ("\x00\x01\x02", ""),
+ ("a\x7fb", "ab"),
+ ("a\x9fb", "ab"),
+ ],
+)
+def test_sanitize_title(raw: str, expected: str) -> None:
+ assert sanitize_title(raw) == expected
Review Comment:
**Suggestion:** Add an inline docstring to this newly introduced test
function describing what behavior is being validated. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The new test function `test_sanitize_title` is introduced in the PR and has
no docstring. The custom rule requires newly added Python functions and classes
to include docstrings, so this is a real violation.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=a3d29e34202849abbf1784e1db8c94d8&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=a3d29e34202849abbf1784e1db8c94d8&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/test_file.py
**Line:** 62:63
**Comment:**
*Custom Rule: Add an inline docstring to this newly introduced test
function describing what behavior is being validated.
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%2F39294&comment_hash=b608c1db4e01d06098b84e2bdfb0541adb05066ad88ec0d7d20dc90013286662&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39294&comment_hash=b608c1db4e01d06098b84e2bdfb0541adb05066ad88ec0d7d20dc90013286662&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]