Skip to content

np.testing.assert_(array_)equal thinks [] and nan are equal #9542

@benfreu

Description

@benfreu

NumPy version 1.13.1

np.testing.assert_array_equal(np.array([]), np.nan) doesn't raise an AssertionError although according to the docs it definitely should - if not for their different values then at least for their different shapes (the nan produced by np.array([]).mean() has a shape).

If this is desired behaviour for a reason I'm overlooking, maybe we should clarify this in the docs. If it's unexpected behaviour this is quite dangerous.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions