• Carlos Ramos Carreño's avatar
    bigarray: tests: Do not use `numpy.object`. · 84d3d775
    Carlos Ramos Carreño authored
    `numpy.object` was an alias for the builtin `object`, so we can use
    `object` instead:
    
    ```python
    _________________________ test_bigarray_noobject[tRAM] _________________________
    
    testbig = <bigarray.tests.test_basic.tRAM object at 0x7f6d114ead60>
    
        def test_bigarray_noobject(testbig):
            Zh = testbig.fopen()
    
            # NOTE str & unicode are fixed-size types - if size is not explicitly given
            # it will become S0 or U0
    >       obj_dtypev = [numpy.object, 'O', 'i4, O', [('x', 'i4'), ('y', 'i4, O')]]
    
    bigarray/tests/test_basic.py:110:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    attr = 'object'
    
        def __getattr__(attr):
            # Warn for expired attributes, and return a dummy function
            # that always raises an exception.
            import warnings
            import math
            try:
                msg = __expired_functions__[attr]
            except KeyError:
                pass
            else:
                warnings.warn(msg, DeprecationWarning, stacklevel=2)
    
                def _expired(*args, **kwds):
                    raise RuntimeError(msg)
    
                return _expired
    
            # Emit warnings for deprecated attributes
            try:
                val, msg = __deprecated_attrs__[attr]
            except KeyError:
                pass
            else:
                warnings.warn(msg, DeprecationWarning, stacklevel=2)
                return val
    
            if attr in __future_scalars__:
                # And future warnings for those that will change, but also give
                # the AttributeError
                warnings.warn(
                    f"In the future `np.{attr}` will be defined as the "
                    "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    
            if attr in __former_attrs__:
    >           raise AttributeError(__former_attrs__[attr])
    E           AttributeError: module 'numpy' has no attribute 'object'.
    E           `np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
    E           The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    E               https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
    ```
    
    --------
    kirr:
    
    On py2:
    
        In [1]: import numpy
    
        In [2]: numpy.__version__
        Out[2]: '1.16.6'
    
        In [3]: numpy.object
        Out[3]: object
    
        In [4]: numpy.object is object
        Out[4]: True
    
    this change is, thus, indeed safe to make.
    
    /reviewed-by @kirr
    /reviewed-on nexedi/wendelin.core!27
    84d3d775
test_basic.py 25.7 KB