Skip to content

DeprecationWarning: elementwise comparison failed in Quantity #8752

@pllim

Description

@pllim

Looking at #7928 , there are a lot of warnings like this:

astropy/nddata/mixins/tests/test_ndarithmetic.py::...
  .../astropy/units/quantity.py:858: DeprecationWarning: elementwise comparison failed;
this will raise an error in the future.
    return super().__ne__(other)

Which brought me to

def __ne__(self, other):
try:
try:
return super().__ne__(other)
except DeprecationWarning:
return np.not_equal(self, other)

Perhaps try ... except ... is not working as expected? Why not use catch_warnings? @mhvk , do you know?

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