-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST/CLN: parameterize/dedup replace test2 #41501
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.
Thanks @mzeitlin11 generally lgtm. can you rename the variables to avoid confusion and maybe move the result assignment outside a conditional (by either conditional setting arguments or skipping to avoid the redundant permutation )
], | ||
) | ||
@pytest.mark.parametrize( | ||
"regex,value", [(r"\s*\.\s*", np.nan), (r"\s*(\.)\s*", r"\1\1\1")] |
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.
regex -> to_replace to match DataFrame.replace parameter name
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.
renamed
"regex,value", [(r"\s*\.\s*", np.nan), (r"\s*(\.)\s*", r"\1\1\1")] | ||
) | ||
@pytest.mark.parametrize("compile_regex", [True, False]) | ||
@pytest.mark.parametrize("use_regex_value_arg", [True, False]) |
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.
use_regex_value_arg -> regex (or regex_kwarg)
There's also a redundant permutation here can maybe add a skip for that case instead of calling with regex=True
explictily.
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.
Renamed arg. Could you please elaborate on the redundant permutation here? Are you referring to when compile_regex=True
and regex_kwarg=False
(so regex=True
does not really need to be specified?)
assert return_value is None | ||
tm.assert_frame_equal(dfobj, res.fillna(".")) | ||
if use_regex_value_arg: | ||
result = df.replace(regex=regex, value=value, inplace=inplace) |
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.
can you put the arguments in the same order as the parameters
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
wow, lgtm. |
thanks @mzeitlin11 |
No description provided.