-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TST: Parametrize and cleanup Exception #28478
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments. Generally nice improvement
pandas/tests/frame/test_indexing.py
Outdated
repr(df) | ||
except Exception as e: | ||
assert type(e) != UnboundLocalError | ||
# Note: this used to be a test that any exception that _is_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should just delete altogether? Maybe missing the point but I don't see what this was testing previously
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will remove
pandas/tests/test_expressions.py
Outdated
@@ -332,78 +331,81 @@ def testit(): | |||
expr.set_numexpr_threads() | |||
testit() | |||
|
|||
def test_bool_ops_raise_on_arithmetic(self): | |||
@pytest.mark.parametrize( | |||
"op,name", list(zip(["/", "//", "**"], ["truediv", "floordiv", "pow"])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think would be nicer to follow the opname, op_str
convention for consistency
pandas/tests/test_expressions.py
Outdated
|
||
def test_bool_ops_warn_on_arithmetic(self): | ||
@pytest.mark.parametrize( | ||
"op,name", list(zip(["+", "*", "-"], ["add", "mul", "sub"])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done and done
pandas/tests/test_expressions.py
Outdated
f = getattr(operator, name) | ||
fe = getattr(operator, sub_funcs[subs[op]]) | ||
|
||
if op == "-": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this even need to be parametrized if we just return?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm planning on re-visiting this in an upcoming pass to see if it can be made viable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small style nitpick for future rounds of parameterization.
@@ -332,78 +331,81 @@ def testit(): | |||
expr.set_numexpr_threads() | |||
testit() | |||
|
|||
def test_bool_ops_raise_on_arithmetic(self): | |||
@pytest.mark.parametrize( | |||
"op_str,opname", list(zip(["/", "//", "**"], ["truediv", "floordiv", "pow"])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you find list(zip(...)
clearer than writing out the pairs?
[('/', 'truediv'), ...]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Will change in next pass.
No description provided.