Skip to content

Generate NumPy scalars for test inputs #289

Closed
@asmeurer

Description

@asmeurer

We should update the arrays strategy so that it can generate NumPy scalars whenever it would generate a 0-D array. This can be done by doing something like

if a.ndim == 0 and draw(booleans()):
    a = a[()]

which would be a no-op in any other library.

There are several issues with NumPy scalars and the array API that are not being caught by the test suite because they aren't being tested. See for instance #287 (NumPy scalars do not have in-place methods), and data-apis/array-api-compat#165 (NumPy scalars were missing __array_namespace__, which to be fair isn't tested anyways #248).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @asmeurer

      Issue actions

        Generate NumPy scalars for test inputs · Issue #289 · data-apis/array-api-tests