-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: [ArrowStringArray] more parameterised testing - part 1 #40679
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
3bb9750
acfb5f5
98b3a5f
56d3717
c095cd4
88b05e8
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 |
---|---|---|
|
@@ -1131,6 +1131,24 @@ def string_dtype(request): | |
return request.param | ||
|
||
|
||
@pytest.fixture( | ||
params=[ | ||
"string", | ||
pytest.param( | ||
"arrow_string", marks=td.skip_if_no("pyarrow", min_version="1.0.0") | ||
), | ||
] | ||
) | ||
def nullable_string_dtype(request): | ||
""" | ||
Parametrized fixture for string dtypes. | ||
|
||
* 'string' | ||
* 'arrow_string' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will change in #39908, but getting the fixture in play as a pre-cursor should still be an advantage. |
||
""" | ||
return request.param | ||
|
||
|
||
@pytest.fixture(params=tm.BYTES_DTYPES) | ||
def bytes_dtype(request): | ||
""" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ | |
ExtensionDtype, | ||
) | ||
from pandas.api.types import is_bool_dtype | ||
from pandas.core.arrays.string_arrow import ArrowStringDtype | ||
|
||
|
||
class JSONDtype(ExtensionDtype): | ||
|
@@ -193,7 +194,7 @@ def astype(self, dtype, copy=True): | |
if copy: | ||
return self.copy() | ||
return self | ||
elif isinstance(dtype, StringDtype): | ||
elif isinstance(dtype, (StringDtype, ArrowStringDtype)): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ArrowStringDtype is removed in #39908 and therefore this change will be reverted. |
||
value = self.astype(str) # numpy doesn'y like nested dicts | ||
return dtype.construct_array_type()._from_sequence(value, copy=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.
could add this instead of changing.
both StringDtype and ArrowStringDtype have
type
attrribute asstr
at the moment the inference matches on
name
so this would need to change for 'string[python]' if we wanted to match onname
edit:
kind
->type
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.
hmm, this doesn't break anything? cause any perf issues?