-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
[ArrowStringArray] TST/CLN: cleanup str.replace tests #41600
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
tm.assert_series_equal(result, expected) | ||
|
||
|
||
def test_replace_regex_default_warning(any_string_dtype): |
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.
this one from pandas/tests/series/methods/test_replace.py and split and tested result
tm.assert_series_equal(result, expected) | ||
|
||
|
||
def test_replace_regex_default_warning_single_character(any_string_dtype): |
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.
split since we don't have testing for the default behavior treating a single character as a literal
@@ -148,6 +152,81 @@ def test_contains_na_kwarg_for_nullable_string_dtype( | |||
tm.assert_series_equal(result, expected) | |||
|
|||
|
|||
def test_contains_moar(any_string_dtype): |
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.
moved from later in the file, collocated with other str.contains tests
ser.str.replace(pat, "", regex=False) | ||
|
||
|
||
def test_replace_moar(any_string_dtype): |
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.
moved from later in the file, collocated with other str.replace tests
tm.assert_series_equal(result, expected) | ||
|
||
expected = Series(["foo__barBAD", np.nan], dtype=any_string_dtype) | ||
result = ser.str.replace("BAD", "", n=1, regex=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.
no coverage for n with regex=False
Hello @simonjayhawkins! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-05-21 10:53:20 UTC |
# https://github.com/pandas-dev/pandas/pull/24809 | ||
|
||
# The current behavior is to treat single character patterns as literal strings, | ||
# even when ``regex`` is set to ``True``. |
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.
add commit to parametrize this test.
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.
great!
[False, False, False, True, False, False, np.nan, False, False, False], | ||
dtype=expected_dtype, | ||
) | ||
tm.assert_series_equal(result, expected) |
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.
could parmaeterize at some point
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.
sure. not doing too many changes in one pass to keep the diff simpler
pre-cursor to #41590