Skip to content
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

Updates PROTOs pdarray_creation_test #3393

Merged
merged 4 commits into from
Jul 18, 2024
Merged

Conversation

drculhane
Copy link
Contributor

This updates PROTO-tests/tests/pdarray_creation_test.py to ensure that it covers all of the same tests that the non-PROTOs version did.

Several tests that are done in one function in tests are done in multiple ones in PROTO-tests (e.g. test_randint vs test_randint_array_dtype, test_randint_num_dtype, test_randint_misc). This makes for a challenging crosswalk, but I think that everything has been updated.

I made the following changes to ones_like, zeros_like, and full_like:

  • added an assert that the new array is the same size as the original (this will change to shape with n-d arrays),
  • changed the creation of the original array so that the "_like" array would have different content.
  • as in, old version was zeros_arr = ak.zeros(size) ; zeros_like_arr = ak.zeros_like(zeros_arr).
  • new version is ran_arr = ak.array(arange(size)) ; zeros_like_arr = ak.zeros_like(ran_arr)
  • as it was, the "_like" functions could have just been doing a copy, and we wouldn't have caught it

In addition to the note above about shape, several other functions will have to be updated when we implement n-d arrays. For example, it currently asserts that n-d arrays have ArrayView type.

Copy link
Contributor

@ajpotts ajpotts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good. I just have the comments about not using numpy unless necessary (for performance reasons on the larger tests on the server) and checking the output of all the arrays that are generated.

PROTO_tests/tests/pdarray_creation_test.py Outdated Show resolved Hide resolved
PROTO_tests/tests/pdarray_creation_test.py Outdated Show resolved Hide resolved
PROTO_tests/tests/pdarray_creation_test.py Show resolved Hide resolved
PROTO_tests/tests/pdarray_creation_test.py Show resolved Hide resolved
PROTO_tests/tests/pdarray_creation_test.py Show resolved Hide resolved
@ajpotts ajpotts added this pull request to the merge queue Jul 18, 2024
Merged via the queue into Bears-R-Us:master with commit c4121e2 Jul 18, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants