-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TST: Split/parameterize test_split_partition.py #44876
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
TST: Split/parameterize test_split_partition.py #44876
Conversation
mroeschke
commented
Dec 14, 2021
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
tm.assert_series_equal(result, expected) | ||
|
||
|
||
def test_rsplit(any_string_dtype): | ||
values = Series(["a_b_c", "c_d_e", np.nan, "f_g_h"], dtype=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.
don't you need these cases?
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.
Parameterized now in test_split
and test_split_more_than_one_char
,
# setting max number of splits, make sure it's from reverse | ||
values = Series(["a_b_c", "c_d_e", np.nan, "f_g_h"], dtype=any_string_dtype) | ||
result = values.str.rsplit("_", n=1) | ||
exp = Series([["a_b", "c"], ["c_d", "e"], np.nan, ["f_g", "h"]]) | ||
tm.assert_series_equal(result, exp) | ||
|
||
|
||
def test_rsplit_object_mixed(): |
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.
where did these go>?
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.
Parameterized now in test_split_object_mixed
def test_partition_series_more_than_one_char(method, exp): | ||
# https://github.com/pandas-dev/pandas/issues/23558 | ||
|
||
s = Series(["a_b_c", "c_d_e", np.nan, "f_g_h", None], dtype=any_string_dtype) | ||
|
||
result = s.str.partition("_", expand=False) | ||
expected = Series( | ||
[("a", "_", "b_c"), ("c", "_", "d_e"), np.nan, ("f", "_", "g_h"), None] | ||
) | ||
# more than one char | ||
s = Series(["a__b__c", "c__d__e", np.nan, "f__g__h", None]) |
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.
any_string_dtype
parameterization?