Skip to content

BUG: np.testing.assert_allclose does not work if argument is empty iterable #27457

@unalmis

Description

@unalmis

Describe the issue:

title

Reproduce the code example:

a = 3 # make this anything you want
np.testing.assert_allclose(a, [])

Error message:

No response

Python and NumPy Versions:

See #27413

Runtime Environment:

See #27413

Context for the issue:

This is misleading for this to pass.

This is docstring

Raises an AssertionError if two objects are not equal up to desired tolerance. Given two array_like objects, check that their shapes and all elements are equal (but see the Notes for the special handling of a scalar). An exception is raised if the shapes mismatch or any values conflict. In contrast to the standard usage in numpy, NaNs are compared like numbers, no assertion is raised if both objects have NaNs in the same positions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions