question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: Table test failures with np 1.23.0rc3

See original GitHub issue
====================================================================== FAILURES =======================================================================
__________________________________________________________ test_col_unicode_sandwich_unicode __________________________________________________________
numpy.core._exceptions._UFuncNoLoopError: ufunc 'not_equal' did not contain a loop with signature matching types (<class 'numpy.dtype[str_]'>, <class 'numpy.dtype[bytes_]'>) -> None

The above exception was the direct cause of the following exception:

    def test_col_unicode_sandwich_unicode():
        """
        Sanity check that Unicode Column behaves normally.
        """
        uba = 'bä'
        uba8 = uba.encode('utf-8')
    
        c = table.Column([uba, 'def'], dtype='U')
        assert c[0] == uba
        assert isinstance(c[:0], table.Column)
        assert isinstance(c[0], str)
        assert np.all(c[:2] == np.array([uba, 'def']))
    
        assert isinstance(c[:], table.Column)
        assert c[:].dtype.char == 'U'
    
        ok = c == [uba, 'def']
        assert type(ok) == np.ndarray
        assert ok.dtype.char == '?'
        assert np.all(ok)
    
>       assert np.all(c != [uba8, b'def'])

astropy/table/tests/test_column.py:777: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Column dtype='str3' length=2>
 bä
def, other = [b'b\xc3\xa4', b'def']

    def _compare(self, other):
        op = oper  # copy enclosed ref to allow swap below
    
        # Special case to work around #6838.  Other combinations work OK,
        # see tests.test_column.test_unicode_sandwich_compare().  In this
        # case just swap self and other.
        #
        # This is related to an issue in numpy that was addressed in np 1.13.
        # However that fix does not make this problem go away, but maybe
        # future numpy versions will do so.  NUMPY_LT_1_13 to get the
        # attention of future maintainers to check (by deleting or versioning
        # the if block below).  See #6899 discussion.
        # 2019-06-21: still needed with numpy 1.16.
        if (isinstance(self, MaskedColumn) and self.dtype.kind == 'U'
                and isinstance(other, MaskedColumn) and other.dtype.kind == 'S'):
            self, other = other, self
            op = swapped_oper
    
        if self.dtype.char == 'S':
            other = self._encode_str(other)
    
        # Now just let the regular ndarray.__eq__, etc., take over.
>       result = getattr(super(Column, self), op)(other)
E       FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison

astropy/table/column.py:329: FutureWarning
______________________________________________ test_unicode_sandwich_compare[MaskedColumn-MaskedColumn] _______________________________________________

class1 = <class 'astropy.table.column.MaskedColumn'>, class2 = <class 'astropy.table.column.MaskedColumn'>

    @pytest.mark.parametrize('class1', [table.MaskedColumn, table.Column])
    @pytest.mark.parametrize('class2', [table.MaskedColumn, table.Column, str, list])
    def test_unicode_sandwich_compare(class1, class2):
        """Test that comparing a bytestring Column/MaskedColumn with various
        str (unicode) object types gives the expected result.  Tests #6838.
        """
        obj1 = class1([b'a', b'c'])
        if class2 is str:
            obj2 = 'a'
        elif class2 is list:
            obj2 = ['a', 'b']
        else:
            obj2 = class2(['a', 'b'])
    
        assert np.all((obj1 == obj2) == [True, False])
        assert np.all((obj2 == obj1) == [True, False])
    
        assert np.all((obj1 != obj2) == [False, True])
        assert np.all((obj2 != obj1) == [False, True])
    
>       assert np.all((obj1 > obj2) == [False, True])
E       TypeError: '>' not supported between instances of 'MaskedColumn' and 'MaskedColumn'

astropy/table/tests/test_column.py:857: TypeError
_________________________________________________ test_unicode_sandwich_compare[Column-MaskedColumn] __________________________________________________

class1 = <class 'astropy.table.column.MaskedColumn'>, class2 = <class 'astropy.table.column.Column'>

    @pytest.mark.parametrize('class1', [table.MaskedColumn, table.Column])
    @pytest.mark.parametrize('class2', [table.MaskedColumn, table.Column, str, list])
    def test_unicode_sandwich_compare(class1, class2):
        """Test that comparing a bytestring Column/MaskedColumn with various
        str (unicode) object types gives the expected result.  Tests #6838.
        """
        obj1 = class1([b'a', b'c'])
        if class2 is str:
            obj2 = 'a'
        elif class2 is list:
            obj2 = ['a', 'b']
        else:
            obj2 = class2(['a', 'b'])
    
        assert np.all((obj1 == obj2) == [True, False])
        assert np.all((obj2 == obj1) == [True, False])
    
        assert np.all((obj1 != obj2) == [False, True])
        assert np.all((obj2 != obj1) == [False, True])
    
>       assert np.all((obj1 > obj2) == [False, True])
E       TypeError: '>' not supported between instances of 'MaskedColumn' and 'Column'

astropy/table/tests/test_column.py:857: TypeError
____________________________________________________ test_unicode_sandwich_compare[Column-Column] _____________________________________________________
numpy.core._exceptions._UFuncNoLoopError: ufunc 'equal' did not contain a loop with signature matching types (<class 'numpy.dtype[str_]'>, <class 'numpy.dtype[bytes_]'>) -> None

The above exception was the direct cause of the following exception:

class1 = <class 'astropy.table.column.Column'>, class2 = <class 'astropy.table.column.Column'>

    @pytest.mark.parametrize('class1', [table.MaskedColumn, table.Column])
    @pytest.mark.parametrize('class2', [table.MaskedColumn, table.Column, str, list])
    def test_unicode_sandwich_compare(class1, class2):
        """Test that comparing a bytestring Column/MaskedColumn with various
        str (unicode) object types gives the expected result.  Tests #6838.
        """
        obj1 = class1([b'a', b'c'])
        if class2 is str:
            obj2 = 'a'
        elif class2 is list:
            obj2 = ['a', 'b']
        else:
            obj2 = class2(['a', 'b'])
    
        assert np.all((obj1 == obj2) == [True, False])
>       assert np.all((obj2 == obj1) == [True, False])

astropy/table/tests/test_column.py:852: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Column dtype='str1' length=2>
a
b, other = <Column dtype='bytes1' length=2>
a
c

    def _compare(self, other):
        op = oper  # copy enclosed ref to allow swap below
    
        # Special case to work around #6838.  Other combinations work OK,
        # see tests.test_column.test_unicode_sandwich_compare().  In this
        # case just swap self and other.
        #
        # This is related to an issue in numpy that was addressed in np 1.13.
        # However that fix does not make this problem go away, but maybe
        # future numpy versions will do so.  NUMPY_LT_1_13 to get the
        # attention of future maintainers to check (by deleting or versioning
        # the if block below).  See #6899 discussion.
        # 2019-06-21: still needed with numpy 1.16.
        if (isinstance(self, MaskedColumn) and self.dtype.kind == 'U'
                and isinstance(other, MaskedColumn) and other.dtype.kind == 'S'):
            self, other = other, self
            op = swapped_oper
    
        if self.dtype.char == 'S':
            other = self._encode_str(other)
    
        # Now just let the regular ndarray.__eq__, etc., take over.
>       result = getattr(super(Column, self), op)(other)
E       FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison

astropy/table/column.py:329: FutureWarning
___________________________________________________ test_unicode_sandwich_compare[str-MaskedColumn] ___________________________________________________

class1 = <class 'astropy.table.column.MaskedColumn'>, class2 = <class 'str'>

    @pytest.mark.parametrize('class1', [table.MaskedColumn, table.Column])
    @pytest.mark.parametrize('class2', [table.MaskedColumn, table.Column, str, list])
    def test_unicode_sandwich_compare(class1, class2):
        """Test that comparing a bytestring Column/MaskedColumn with various
        str (unicode) object types gives the expected result.  Tests #6838.
        """
        obj1 = class1([b'a', b'c'])
        if class2 is str:
            obj2 = 'a'
        elif class2 is list:
            obj2 = ['a', 'b']
        else:
            obj2 = class2(['a', 'b'])
    
        assert np.all((obj1 == obj2) == [True, False])
        assert np.all((obj2 == obj1) == [True, False])
    
        assert np.all((obj1 != obj2) == [False, True])
        assert np.all((obj2 != obj1) == [False, True])
    
>       assert np.all((obj1 > obj2) == [False, True])
E       TypeError: '>' not supported between instances of 'MaskedColumn' and 'str'

astropy/table/tests/test_column.py:857: TypeError
__________________________________________________ test_unicode_sandwich_compare[list-MaskedColumn] ___________________________________________________

class1 = <class 'astropy.table.column.MaskedColumn'>, class2 = <class 'list'>

    @pytest.mark.parametrize('class1', [table.MaskedColumn, table.Column])
    @pytest.mark.parametrize('class2', [table.MaskedColumn, table.Column, str, list])
    def test_unicode_sandwich_compare(class1, class2):
        """Test that comparing a bytestring Column/MaskedColumn with various
        str (unicode) object types gives the expected result.  Tests #6838.
        """
        obj1 = class1([b'a', b'c'])
        if class2 is str:
            obj2 = 'a'
        elif class2 is list:
            obj2 = ['a', 'b']
        else:
            obj2 = class2(['a', 'b'])
    
        assert np.all((obj1 == obj2) == [True, False])
        assert np.all((obj2 == obj1) == [True, False])
    
        assert np.all((obj1 != obj2) == [False, True])
        assert np.all((obj2 != obj1) == [False, True])
    
>       assert np.all((obj1 > obj2) == [False, True])
E       TypeError: '>' not supported between instances of 'MaskedColumn' and 'list'

astropy/table/tests/test_column.py:857: TypeError
=============================================================== short test summary info ===============================================================
FAILED astropy/table/tests/test_column.py::test_col_unicode_sandwich_unicode - FutureWarning: elementwise comparison failed; returning scalar instea...
FAILED astropy/table/tests/test_column.py::test_unicode_sandwich_compare[MaskedColumn-MaskedColumn] - TypeError: '>' not supported between instances...
FAILED astropy/table/tests/test_column.py::test_unicode_sandwich_compare[Column-MaskedColumn] - TypeError: '>' not supported between instances of 'M...
FAILED astropy/table/tests/test_column.py::test_unicode_sandwich_compare[Column-Column] - FutureWarning: elementwise comparison failed; returning sc...
FAILED astropy/table/tests/test_column.py::test_unicode_sandwich_compare[str-MaskedColumn] - TypeError: '>' not supported between instances of 'Mask...
FAILED astropy/table/tests/test_column.py::test_unicode_sandwich_compare[list-MaskedColumn] - TypeError: '>' not supported between instances of 'Mas...
=============================================== 6 failed, 3377 passed, 43 skipped, 14 xfailed in 25.62s ===============================================

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:20 (20 by maintainers)

github_iconTop GitHub Comments

2reactions
mhvkcommented, Jun 16, 2022

@pllim - those other errors are actually due to a bug in Quantity, where the unit of an initial argument is not taken into account (and where units are no longer stripped in numpy). Working on a fix…

1reaction
mhvkcommented, Jun 23, 2022

I actually don’t know that -dev was changed too - I think they just reverted the bad commit from 1.23, with the idea that for 1.24 there would be a fix (IIRC, https://github.com/numpy/numpy/pull/21812 would solve at least some of the problems)

Read more comments on GitHub >

github_iconTop Results From Across the Web

NumPy: doc/changelog/1.23.0-changelog.rst - Fossies
#21368: MAINT: Fix failing Python 3.8 32-bit Windows test. #21372: BUG: Allow legacy dtypes to cast to datetime again; #21377: API: Allow newaxis...
Read more >
Bug listing with status RESOLVED with resolution FIXED as at ...
Bug :2 - "How do I attach an ebuild. ... Bug:262 - "dev-perl/PDL fails test "t/picnorgb.t", and so won't emerge" status:RESOLVED resolution:FIXED severity: ......
Read more >
How to know what python version a package is compatible with
I tried to install an old version of a python package and got the Could not find a version that satisfies the requirement......
Read more >
Table Grid Editor - Version history - Atlassian Marketplace
IGRID-3588 - Connected grid configuration fails with query that starts with SELECT word · IGRID-3603 - Connected Grid does not show count of...
Read more >
Release Notes — Numba 0.56.4+0.g288a38bbd.dirty-py3.7 ...
This is a bugfix release that supports NumPy 1.23 and fixes CUDA function caching. ... PR #8080: Fix windows test failure due to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found