10000 TST: Added script to enforce usage of match argument for tm.assert_produces_warning by chaarvii · Pull Request #59173 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

TST: Added script to enforce usage of match argument for tm.assert_produces_warning #59173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update comments
  • Loading branch information
chaarvii committed Jul 3, 2024
commit 7c4caf24f1c5aac1a358c54eb561f1770eb417bc
6 changes: 4 additions & 2 deletions scripts/enforce_match_arg_in_assert_produces_warning.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
the "match" argument. This will help ensure that users always see
the correct warning message.

tm.assert_produces_warning(None) is excluded as no warning is
tm.assert_produces_warning(None), tm.assert_produces_warning()
and tm.assert_produces_warning(False) are excluded as no warning is
produced.

"""
Expand Down Expand Up @@ -32,7 +33,8 @@ def visit_Call(self, node) -> None:
# only check for attribute function of class/module tm
if ( isinstance(node.func.value, ast.Name) and
node.func.value.id == "tm" ):
# ignore tm.assert_produces_warning(None)/tm.assert_produces_warning()
# ignore tm.assert_produces_warning(None),tm.assert_produces_warning()
# and tm.assert_produces_warning(False)
if ( len(node.args) == 0 or
(isinstance(node.args[0], ast.Constant) and
( node.args[0].value is None or node.args[0].value is False))):
Expand Down
0