-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
TST: [ArrowStringArray] more parameterised testing - part 2 #40749
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
Changes from 1 commit
8d9c1cd
74f0c1d
1d69414
374d8d0
52c7a2c
daf661e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -566,7 +566,6 @@ def test_astype_empty_dtype_dict(self): | |
@pytest.mark.parametrize( | ||
"df", | ||
[ | ||
DataFrame(Series(["x", "y", "z"], dtype="string")), | ||
DataFrame(Series(["x", "y", "z"], dtype="category")), | ||
DataFrame(Series(3 * [Timestamp("2020-01-01", tz="UTC")])), | ||
DataFrame(Series(3 * [Interval(0, 1)])), | ||
|
@@ -584,6 +583,20 @@ def test_astype_ignores_errors_for_extension_dtypes(self, df, errors): | |
with pytest.raises((ValueError, TypeError), match=msg): | ||
df.astype(float, errors=errors) | ||
|
||
@pytest.mark.parametrize("errors", ["raise", "ignore"]) | ||
|
||
def test_astype_ignores_errors_for_nullable_string_dtypes( | ||
self, nullable_string_dtype, errors | ||
): | ||
df = DataFrame(Series(["x", "y", "z"], dtype=nullable_string_dtype)) | ||
if errors == "ignore": | ||
expected = df | ||
result = df.astype(float, errors=errors) | ||
tm.assert_frame_equal(result, expected) | ||
else: | ||
msg = "(Cannot cast)|(could not convert)" | ||
with pytest.raises((ValueError, TypeError), match=msg): | ||
df.astype(float, errors=errors) | ||
|
||
def test_astype_tz_conversion(self): | ||
# GH 35973 | ||
val = {"tz": date_range("2020-08-30", freq="d", periods=2, tz="Europe/London")} | ||
|
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've added this to force the registration of the
arrow_string
dtype. running some tests individually sometimes fails. will be removed in #39908There 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.
you need to handle the import error here and xfail
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 elaborate or I can just remove.
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 would raise an import error right on some builds? if so simply xfail if this errors and the tests would also xfail
that way u can use this fixture w/o worrying too much
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.
The tests are skipped with the fixture. It's passing tests that may fail if the
arrow_string
dtype is not registered, it's not part of the public api yet. and won't be since we are going to use the parameterized dtype in #39908 instead.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.
see also #39908 (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.
no. importing the ArrowStringDtype is safe.
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 c, ok then