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

TST: Test copy behavior in astype #335

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lithomas1
Copy link

@lithomas1 lithomas1 commented Jan 16, 2025

The copy keyword was previously not checked.

"""
Assert copy=True/False functionality is respected

TODO: we're not able to check scalars with this approach

Choose a reason for hiding this comment

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

We should definitely be able to check 0-dimensional arrays. What we can't check is np.generic, whiich AFAIK is a numpy-specific type

Comment on lines +497 to +501
def assert_kw_copy(func_name, x, out, data, copy):
"""
Assert copy=True/False functionality is respected

TODO: we're not able to check scalars with this approach

Choose a reason for hiding this comment

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

This doesn't look right.

  • astype(copy=True) should behave like asarray(copy=True).
  • astype(copy=False) should behave like asarray(copy=None).
  • asarray(copy=False) has no matching behaviour in astype.

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.

2 participants