Skip to content

BUG: change in behavior of assert_equal in numpy '1.13.0.dev0+c25db39' #8848

Closed
@WarrenWeckesser

Description

@WarrenWeckesser

This change in behavior resulted in failure of a scipy test.

numpy 1.12.1

In [3]: from numpy.testing import assert_equal

In [4]: assert_equal(np.complex128(-0j), 0)

The assertion succeeds.

numpy '1.13.0.dev0+c25db39'

In [20]: from numpy.testing import assert_equal

In [21]: assert_equal(np.complex128(-0j), 0)
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
/Users/warren/miniconda3numpy/lib/python3.5/site-packages/numpy-1.13.0.dev0+c25db39-py3.5-macosx-10.6-x86_64.egg/numpy/testing/utils.py in assert_equal(actual, desired, err_msg, verbose)
    366         try:
--> 367             assert_equal(actualr, desiredr)
    368             assert_equal(actuali, desiredi)

/Users/warren/miniconda3numpy/lib/python3.5/site-packages/numpy-1.13.0.dev0+c25db39-py3.5-macosx-10.6-x86_64.egg/numpy/testing/utils.py in assert_equal(actual, desired, err_msg, verbose)
    392             if not signbit(desired) == signbit(actual):
--> 393                 raise AssertionError(msg)
    394     # If TypeError or ValueError raised while using isnan and co, just handle

AssertionError: 
Items are not equal:
 ACTUAL: -0.0
 DESIRED: 0

During handling of the above exception, another exception occurred:

AssertionError                            Traceback (most recent call last)
<ipython-input-21-8adfca176832> in <module>()
----> 1 assert_equal(np.complex128(-0j), 0)

/Users/warren/miniconda3numpy/lib/python3.5/site-packages/numpy-1.13.0.dev0+c25db39-py3.5-macosx-10.6-x86_64.egg/numpy/testing/utils.py in assert_equal(actual, desired, err_msg, verbose)
    368             assert_equal(actuali, desiredi)
    369         except AssertionError:
--> 370             raise AssertionError(msg)
    371 
    372     # Inf/nan/negative zero handling

AssertionError: 
Items are not equal:
 ACTUAL: (-0-0j)
 DESIRED: 0

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