ARROW-4181: [Python] Fixes for Numpy struct array conversion#3614
Closed
pitrou wants to merge 1 commit intoapache:masterfrom
Closed
ARROW-4181: [Python] Fixes for Numpy struct array conversion#3614pitrou wants to merge 1 commit intoapache:masterfrom
pitrou wants to merge 1 commit intoapache:masterfrom
Conversation
This fixes two issues: - object fields inside numpy structs should be allowed - buggy ndarray indexing if stride % itemsize != 0
06b7fc4 to
9886e29
Compare
Member
|
@pitrou You can test edge cases with hypothesis, like the following: import hypothesis as h
import hypothesis.extra.numpy as npst
supported_scalar_dtypes = (npst.boolean_dtypes() |
npst.integer_dtypes() |
npst.unsigned_integer_dtypes() |
npst.floating_dtypes() |
npst.datetime64_dtypes())
@h.given(
npst.arrays(npst.nested_dtypes(supported_scalar_dtypes), shape=(5,))
)
def test_nested_struct_array_from_numpy(numpy_array):
pa.array(numpy_array)
Or to test converting to pylist: import hypothesis as h
import pyarrow.tests.strategies as past
@h.given(
past.arrays(past.nested_struct_types())
)
def test_nested_pyarrow_array_to_pylist(pyarrow_array):
pyarrow_array.to_pylist()And run with: pytest -sv --enable-hypothesis --hypothesis-show-statistics --hypothesis-profile=devor to print the generated examples: pytest -sv --enable-hypothesis --hypothesis-show-statistics --hypothesis-profile=debug |
Member
Author
|
When fixing a specific bug, I think I'd rather rely on manual testing and know exactly what's being tested. |
Member
|
Agree, just wanted to inform You about a handy way to discover bugs :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes two issues: