Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-lazyarray for openSUSE:Factory checked in at 2022-02-07 23:38:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-lazyarray (Old) and /work/SRC/openSUSE:Factory/.python-lazyarray.new.1898 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-lazyarray" Mon Feb 7 23:38:07 2022 rev:5 rq:952049 version:0.5.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-lazyarray/python-lazyarray.changes 2021-11-10 21:47:02.959827171 +0100 +++ /work/SRC/openSUSE:Factory/.python-lazyarray.new.1898/python-lazyarray.changes 2022-02-07 23:39:13.865976140 +0100 @@ -1,0 +2,10 @@ +Fri Feb 4 15:48:23 UTC 2022 - Ben Greiner <c...@bnavigator.de> + +- Update to 0.5.2: + * Fix problem where SciPy was required, not optional + * Add support for Python 3.10, remove testing for Python 3.4 and + NumPy 1.12 + * Switch from nose to pytest for running tests +- Drop use-pytest.patch + +------------------------------------------------------------------- Old: ---- lazyarray-0.5.0.tar.gz use-pytest.patch New: ---- lazyarray-0.5.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-lazyarray.spec ++++++ --- /var/tmp/diff_new_pack.eXnKW0/_old 2022-02-07 23:39:14.357972775 +0100 +++ /var/tmp/diff_new_pack.eXnKW0/_new 2022-02-07 23:39:14.361972747 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-lazyarray # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,27 +16,25 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%{?!python_module:%define python_module() python3-%{**}} %define skip_python2 1 -%global skip_python36 1 Name: python-lazyarray -Version: 0.5.0 +Version: 0.5.2 Release: 0 Summary: Lazily-evaluated numerical array class, compatible with NumPy arrays License: BSD-3-Clause URL: http://github.com/NeuralEnsemble/lazyarray/ Source: https://files.pythonhosted.org/packages/source/l/lazyarray/lazyarray-%{version}.tar.gz -# gh#NeuralEnsemble/lazyarray/pulls/15 -Patch0: use-pytest.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros # SECTION test requirements -BuildRequires: %{python_module numpy >= 1.5} +BuildRequires: %{python_module numpy >= 1.13} BuildRequires: %{python_module pytest} -BuildRequires: %{python_module scipy} +BuildRequires: %{python_module scipy >= 0.19} # /SECTION -Requires: python-numpy >= 1.5 +Requires: python-numpy >= 1.13 +Recommends: python-scipy >= 0.19 BuildArch: noarch %python_subpackages @@ -75,6 +73,8 @@ %files %{python_files} %doc README.rst changelog.txt %license LICENSE -%{python_sitelib}/* +%{python_sitelib}/lazyarray.py* +%pycache_only %{python_sitelib}/__pycache__/lazyarray*.pyc +%{python_sitelib}/lazyarray-%{version}*-info %changelog ++++++ lazyarray-0.5.0.tar.gz -> lazyarray-0.5.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lazyarray-0.5.0/LICENSE new/lazyarray-0.5.2/LICENSE --- old/lazyarray-0.5.0/LICENSE 2021-03-16 10:55:39.129128000 +0100 +++ new/lazyarray-0.5.2/LICENSE 2022-01-24 17:23:26.799822600 +0100 @@ -1,4 +1,4 @@ -Copyright (c) 2012-2020, Andrew P. Davison, Jo??l Chavas and Elodie Legou??e (CNRS) +Copyright (c) 2012-2022, Andrew P. Davison, Jo??l Chavas, Elodie Legou??e (CNRS) and Ankur Sinha (UCL) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lazyarray-0.5.0/PKG-INFO new/lazyarray-0.5.2/PKG-INFO --- old/lazyarray-0.5.0/PKG-INFO 2021-11-09 13:39:44.744317300 +0100 +++ new/lazyarray-0.5.2/PKG-INFO 2022-01-24 18:12:13.057306800 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: lazyarray -Version: 0.5.0 +Version: 0.5.2 Summary: a Python package that provides a lazily-evaluated numerical array class, larray, based on and compatible with NumPy arrays. Home-page: http://github.com/NeuralEnsemble/lazyarray/ Author: Andrew P. Davison diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lazyarray-0.5.0/changelog.txt new/lazyarray-0.5.2/changelog.txt --- old/lazyarray-0.5.0/changelog.txt 2021-11-09 13:30:33.910052300 +0100 +++ new/lazyarray-0.5.2/changelog.txt 2022-01-24 17:23:26.800475100 +0100 @@ -117,6 +117,17 @@ * Add partial support for NumPy ufuncs that require two arguments, e.g. "power". The second argument must be a scalar, array-valued second args are not yet supported. +Release 0.5.1 +============= + +* Fix problem where SciPy was required, not optional + +Release 0.5.2 +============= + +* Add support for Python 3.10, remove testing for Python 3.4 and NumPy 1.12 +* Switch from nose to pytest for running tests + .. _`#3`: https://bitbucket.org/apdavison/lazyarray/issue/3/ .. _`#4`: https://bitbucket.org/apdavison/lazyarray/issue/4/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lazyarray-0.5.0/doc/developers.txt new/lazyarray-0.5.2/doc/developers.txt --- old/lazyarray-0.5.0/doc/developers.txt 2019-05-13 13:40:11.830153500 +0200 +++ new/lazyarray-0.5.2/doc/developers.txt 2022-01-24 17:23:18.960820000 +0100 @@ -9,11 +9,11 @@ In the `test` sub-directory, run:: - $ nosetests - + $ pytest + To see how well the tests cover the code base, run:: - $ nosetests --with-coverage --cover-package=lazyarray --cover-erase --cover-html + $ pytest --cov=lazyarray --cov-report html --cov-report term-missing Making a release @@ -21,7 +21,7 @@ * Update the version numbers in setup.py, lazyarray.py, doc/conf.py and doc/installation.txt * Update changelog.txt -* Run all the tests with both Python 2 and Python 3 +* Run all the tests with Python 3 * python setup.py sdist upload * Update the download link in doc/installation.txt * Commit the changes, tag with release number, push to Github diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lazyarray-0.5.0/doc/installation.txt new/lazyarray-0.5.2/doc/installation.txt --- old/lazyarray-0.5.0/doc/installation.txt 2021-11-09 13:37:44.368170700 +0100 +++ new/lazyarray-0.5.2/doc/installation.txt 2022-01-24 18:12:08.621173000 +0100 @@ -5,9 +5,9 @@ Dependencies ============ - * Python >= 3.4 - * numpy_ >= 1.12 - * (optional) scipy_ >= 0.17 + * Python >= 3.6 + * numpy_ >= 1.13 + * (optional) scipy_ >= 0.19 Installing from the Python Package Index ======================================== @@ -21,19 +21,19 @@ To download and install manually, download: - https://pypi.python.org/packages/source/l/lazyarray/lazyarray-0.5.0.tar.gz + https://pypi.python.org/packages/source/l/lazyarray/lazyarray-0.5.2.tar.gz Then:: - $ tar xzf lazyarray-0.5.0.tar.gz - $ cd lazyarray-0.5.0 + $ tar xzf lazyarray-0.5.2.tar.gz + $ cd lazyarray-0.5.2 $ python setup.py install or:: $ python3 setup.py install -depending on which version of Python you are using. +depending on what your Python interpreter is named. Installing from source diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lazyarray-0.5.0/lazyarray.py new/lazyarray-0.5.2/lazyarray.py --- old/lazyarray-0.5.0/lazyarray.py 2021-11-09 13:30:33.911081300 +0100 +++ new/lazyarray-0.5.2/lazyarray.py 2022-01-24 17:23:26.802628500 +0100 @@ -3,26 +3,33 @@ lazyarray is a Python package that provides a lazily-evaluated numerical array class, ``larray``, based on and compatible with NumPy arrays. -Copyright Andrew P. Davison, Jo??l Chavas and Elodie Legou??e (CNRS), 2012-2020 +Copyright Andrew P. Davison, Jo??l Chavas, Elodie Legou??e (CNRS) and Ankur Sinha, 2012-2022 """ import numbers import operator from copy import deepcopy -import collections from functools import wraps, reduce import logging import numpy as np try: from scipy import sparse - from scipy.sparse import bsr_matrix, coo_matrix, csc_matrix, csr_matrix, dia_matrix, dok_matrix, lil_matrix have_scipy = True except ImportError: have_scipy = False +try: + from collections.abc import Sized + from collections.abc import Mapping + from collections.abc import Iterator +except ImportError: + from collections import Sized + from collections import Mapping + from collections import Iterator + -__version__ = "0.5.0" +__version__ = "0.5.2" logger = logging.getLogger("lazyarray") @@ -72,7 +79,7 @@ elif isinstance(x, slice): y = min(max, x.stop or max) # slice limits can go past the bounds return 1 + (y - (x.start or 0) - 1) // (x.step or 1) - elif isinstance(x, collections.Sized): + elif isinstance(x, Sized): if hasattr(x, 'dtype') and x.dtype == bool: return x.sum() else: @@ -83,7 +90,7 @@ addr = full_address(addr, full_shape) if isinstance(addr, np.ndarray) and addr.dtype == bool: return (addr.sum(),) - elif all(isinstance(x, collections.Sized) for x in addr): + elif all(isinstance(x, Sized) for x in addr): return (len(addr[0]),) else: shape = [size(x, max) for (x, max) in zip(addr, full_shape)] @@ -130,11 +137,11 @@ def is_array_like(value): # False for numbers, generators, functions, iterators - if not isinstance(value, collections.Sized): + if not isinstance(value, Sized): return False - if sparse.issparse(value): + if have_scipy and sparse.issparse(value): return True - if isinstance(value, collections.Mapping): + if isinstance(value, Mapping): # because we may wish to have lazy arrays in which each # item is a dict, for example return False @@ -322,7 +329,7 @@ (x.stop or max), (x.step or 1), dtype=int) - elif isinstance(x, collections.Sized): + elif isinstance(x, Sized): if hasattr(x, 'dtype') and x.dtype == bool: return np.arange(max)[x] else: @@ -335,7 +342,7 @@ return (np.arange(self._shape[0])[addr],) else: raise NotImplementedError() - elif all(isinstance(x, collections.Sized) for x in addr): + elif all(isinstance(x, Sized) for x in addr): indices = [np.array(x) for x in addr] return indices else: @@ -343,8 +350,8 @@ if len(indices) == 1: return indices elif len(indices) == 2: - if isinstance(indices[0], collections.Sized): - if isinstance(indices[1], collections.Sized): + if isinstance(indices[0], Sized): + if isinstance(indices[1], Sized): mesh_xy = np.meshgrid(*indices) return (mesh_xy[0].T, mesh_xy[1].T) # meshgrid works on (x,y), not (i,j) return indices @@ -394,7 +401,7 @@ base_val = base_val[0] elif partial_shape and base_val.shape != partial_shape: base_val = base_val.reshape(partial_shape) - elif isinstance(self.base_value, collections.Iterator): + elif isinstance(self.base_value, Iterator): raise NotImplementedError("coming soon...") else: raise ValueError("invalid base value for array (%s)" % self.base_value) @@ -414,7 +421,7 @@ elif isinstance(x, slice): lower = x.start or 0 upper = min(x.stop or size - 1, size - 1) # slices are allowed to go past the bounds - elif isinstance(x, collections.Sized): + elif isinstance(x, Sized): if is_boolean_array(x): lower = 0 upper = x.size - 1 @@ -504,7 +511,7 @@ x = np.where(x, x, np.nan) else: x = self.base_value.toarray((sparse.csc_matrix)) - elif isinstance(self.base_value, collections.Iterator): + elif isinstance(self.base_value, Iterator): x = np.fromiter(self.base_value, dtype=self.dtype or float, count=self.size) if x.shape != self._shape: x = x.reshape(self._shape) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lazyarray-0.5.0/setup.py new/lazyarray-0.5.2/setup.py --- old/lazyarray-0.5.0/setup.py 2021-11-09 13:30:33.911701700 +0100 +++ new/lazyarray-0.5.2/setup.py 2022-01-24 17:23:26.803334200 +0100 @@ -4,7 +4,7 @@ setup( name='lazyarray', - version='0.5.0', + version='0.5.2', py_modules=['lazyarray'], license='Modified BSD', author="Andrew P. Davison", @@ -13,7 +13,7 @@ description="a Python package that provides a lazily-evaluated numerical array class, larray, based on and compatible with NumPy arrays.", long_description=open('README.rst').read(), install_requires=[ - "numpy >= 1.8", + "numpy >= 1.13", ], classifiers=[ 'Development Status :: 4 - Beta', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lazyarray-0.5.0/test/test_lazyarray.py new/lazyarray-0.5.2/test/test_lazyarray.py --- old/lazyarray-0.5.0/test/test_lazyarray.py 2021-03-25 15:39:01.584420000 +0100 +++ new/lazyarray-0.5.2/test/test_lazyarray.py 2022-01-24 17:23:18.963446400 +0100 @@ -2,16 +2,15 @@ """ Unit tests for ``larray`` class -Copyright Andrew P. Davison, Jo??l Chavas and Elodie Legou??e (CNRS), 2012-2020 +Copyright Andrew P. Davison, Jo??l Chavas, Elodie Legou??e (CNRS) and Ankur Sinha (UCL), 2012-2022 """ from lazyarray import larray, VectorizedIterable, sqrt, partial_shape import numpy as np -from nose.tools import assert_raises, assert_equal, assert_not_equal -from nose import SkipTest from numpy.testing import assert_array_equal, assert_array_almost_equal import operator from copy import deepcopy +import pytest from scipy.sparse import bsr_matrix, coo_matrix, csc_matrix, csr_matrix, dia_matrix, dok_matrix, lil_matrix @@ -96,11 +95,11 @@ def test_create_inconsistent(): - assert_raises(ValueError, larray, [1, 2, 3], shape=4) + pytest.raises(ValueError, larray, [1, 2, 3], shape=4) def test_create_with_string(): - assert_raises(TypeError, larray, "123", shape=3) + pytest.raises(TypeError, larray, "123", shape=3) def test_create_with_larray(): @@ -180,19 +179,19 @@ def test_getitem_from_2D_sparse_array(): - assert_raises(IndexError, bsr.__getitem__, (3, 0)) - assert_raises(IndexError, coo.__getitem__, (3, 0)) - assert_raises(IndexError, csc.__getitem__, (3, 0)) - assert_raises(IndexError, csr.__getitem__, (3, 0)) - assert_raises(IndexError, dia.__getitem__, (3, 0)) - assert_raises(IndexError, dok.__getitem__, (3, 0)) - assert_raises(IndexError, lil.__getitem__, (3, 0)) + pytest.raises(IndexError, bsr.__getitem__, (3, 0)) + pytest.raises(IndexError, coo.__getitem__, (3, 0)) + pytest.raises(IndexError, csc.__getitem__, (3, 0)) + pytest.raises(IndexError, csr.__getitem__, (3, 0)) + pytest.raises(IndexError, dia.__getitem__, (3, 0)) + pytest.raises(IndexError, dok.__getitem__, (3, 0)) + pytest.raises(IndexError, lil.__getitem__, (3, 0)) # def test_columnwise_iteration_with_flat_array(): # m = larray(5, shape=(4,3)) # 4 rows, 3 columns # cols = [col for col in m.by_column()] -# assert_equal(cols, [5, 5, 5]) +# assert cols == [5, 5, 5] # # def test_columnwise_iteration_with_structured_array(): # input = np.arange(12).reshape((4,3)) @@ -213,7 +212,7 @@ # m = larray(5, shape=(4,3)) # 4 rows, 3 columns # mask = np.array([True, False, True]) # cols = [col for col in m.by_column(mask=mask)] -# assert_equal(cols, [5, 5]) +# assert cols == [5, 5] # # def test_columnwise_iteration_with_structured_array_and_mask(): # input = np.arange(12).reshape((4,3)) @@ -228,15 +227,15 @@ m1 = larray(1, shape=(9, 7)) m2 = larray(1, shape=(13,)) m3 = larray(1) - assert_equal(m1.nrows, 9) - assert_equal(m1.ncols, 7) - assert_equal(m1.size, 63) - assert_equal(m2.nrows, 13) - assert_equal(m2.ncols, 1) - assert_equal(m2.size, 13) - assert_raises(ValueError, lambda: m3.nrows) - assert_raises(ValueError, lambda: m3.ncols) - assert_raises(ValueError, lambda: m3.size) + assert m1.nrows == 9 + assert m1.ncols == 7 + assert m1.size == 63 + assert m2.nrows == 13 + assert m2.ncols == 1 + assert m2.size == 13 + pytest.raises(ValueError, lambda: m3.nrows) + pytest.raises(ValueError, lambda: m3.ncols) + pytest.raises(ValueError, lambda: m3.size) def test_evaluate_with_flat_array(): @@ -279,31 +278,31 @@ def test_evaluate_structured_array_size_1_simplify(): m = larray([5.0], shape=(1,)) - assert_equal(m.evaluate(simplify=True), 5.0) + assert m.evaluate(simplify=True) == 5.0 n = larray([2.0], shape=(1,)) - assert_equal((m/n).evaluate(simplify=True), 2.5) + assert (m/n).evaluate(simplify=True) == 2.5 def test_iadd_with_flat_array(): m = larray(5, shape=(4, 3)) m += 2 assert_array_equal(m.evaluate(), 7 * np.ones((4, 3))) - assert_equal(m.base_value, 5) - assert_equal(m.evaluate(simplify=True), 7) + assert m.base_value == 5 + assert m.evaluate(simplify=True) == 7 def test_add_with_flat_array(): m0 = larray(5, shape=(4, 3)) m1 = m0 + 2 - assert_equal(m1.evaluate(simplify=True), 7) - assert_equal(m0.evaluate(simplify=True), 5) + assert m1.evaluate(simplify=True) == 7 + assert m0.evaluate(simplify=True) == 5 def test_lt_with_flat_array(): m0 = larray(5, shape=(4, 3)) m1 = m0 < 10 - assert_equal(m1.evaluate(simplify=True), True) - assert_equal(m0.evaluate(simplify=True), 5) + assert m1.evaluate(simplify=True) is True + assert m0.evaluate(simplify=True) == 5 def test_lt_with_structured_array(): @@ -358,7 +357,7 @@ m1 = 0.2 + m0 assert_array_almost_equal(m0.evaluate(), np.array([0.0, 0.01, 0.02, 0.03, 0.04]), decimal=12) assert_array_almost_equal(m1.evaluate(), np.array([0.20, 0.21, 0.22, 0.23, 0.24]), decimal=12) - assert_equal(m1[0], 0.2) + assert m1[0] == 0.2 def test_operations_combining_constant_and_structured_arrays(): @@ -373,10 +372,10 @@ m0 = larray(5, shape=(4, 3)) m1 = f(m0) assert isinstance(m1, larray) - assert_equal(m1.evaluate(simplify=True), 13) + assert m1.evaluate(simplify=True) == 13 # the following tests the internals, not the behaviour # it is just to check I understand what's going on - assert_equal(m1.operations, [(operator.mul, 2), (operator.add, 3)]) + assert m1.operations == [(operator.mul, 2), (operator.add, 3)] def test_apply_function_to_structured_array(): @@ -404,24 +403,24 @@ m0 = larray(5, shape=(4, 3)) m1 = larray(7, shape=(4, 3)) m2 = m0 + m1 - assert_equal(m2.evaluate(simplify=True), 12) + assert m2.evaluate(simplify=True) == 12 # the following tests the internals, not the behaviour # it is just to check I understand what's going on - assert_equal(m2.base_value, m0.base_value) - assert_equal(m2.operations, [(operator.add, m1)]) + assert m2.base_value == m0.base_value + assert m2.operations == [(operator.add, m1)] def test_add_incommensurate_arrays(): m0 = larray(5, shape=(4, 3)) m1 = larray(7, shape=(5, 3)) - assert_raises(ValueError, m0.__add__, m1) + pytest.raises(ValueError, m0.__add__, m1) def test_getitem_from_2D_constant_array(): m = larray(3, shape=(4, 3)) assert m[0, 0] == m[3, 2] == m[-1, 2] == m[-4, 2] == m[2, -3] == 3 - assert_raises(IndexError, m.__getitem__, (4, 0)) - assert_raises(IndexError, m.__getitem__, (2, -4)) + pytest.raises(IndexError, m.__getitem__, (4, 0)) + pytest.raises(IndexError, m.__getitem__, (2, -4)) def test_getitem_from_1D_constant_array(): @@ -437,7 +436,7 @@ def test_getitem__with_thinslice_from_constant_array(): m = larray(3, shape=(4, 3)) - assert_equal(m[2:3, 0:1], 3) + assert m[2:3, 0:1] == 3 def test_getitem__with_mask_from_constant_array(): @@ -448,7 +447,7 @@ def test_getitem_with_numpy_integers_from_2D_constant_array(): if not hasattr(np, "int64"): - raise SkipTest("test requires a 64-bit system") + pytest.skip("test requires a 64-bit system") m = larray(3, shape=(4, 3)) assert m[np.int64(0), np.int32(0)] == 3 @@ -469,23 +468,23 @@ def test_getitem_from_structured_array(): m = larray(3 * np.ones((4, 3)), shape=(4, 3)) assert m[0, 0] == m[3, 2] == m[-1, 2] == m[-4, 2] == m[2, -3] == 3 - assert_raises(IndexError, m.__getitem__, (4, 0)) - assert_raises(IndexError, m.__getitem__, (2, -4)) + pytest.raises(IndexError, m.__getitem__, (4, 0)) + pytest.raises(IndexError, m.__getitem__, (2, -4)) def test_getitem_from_2D_functional_array(): m = larray(lambda i, j: 2 * i + j, shape=(6, 5)) - assert_equal(m[5, 4], 14) + assert m[5, 4] == 14 def test_getitem_from_1D_functional_array(): m = larray(lambda i: i ** 3, shape=(6,)) - assert_equal(m[5], 125) + assert m[5] == 125 def test_getitem_from_3D_functional_array(): m = larray(lambda i, j, k: i + j + k, shape=(2, 3, 4)) - assert_raises(NotImplementedError, m.__getitem__, (0, 1, 2)) + pytest.raises(NotImplementedError, m.__getitem__, (0, 1, 2)) def test_getitem_from_vectorized_iterable(): @@ -493,8 +492,8 @@ m = larray(input, shape=(7,)) m3 = m[3] assert isinstance(m3, (int, np.integer)) - assert_equal(m3, 0) - assert_equal(m[0], 1) + assert m3 == 0 + assert m[0] == 1 def test_getitem_with_slice_from_2D_functional_array(): @@ -543,7 +542,7 @@ def test_getitem_from_iterator_array(): m = larray(iter([1, 2, 3]), shape=(3,)) - assert_raises(NotImplementedError, m.__getitem__, 2) + pytest.raises(NotImplementedError, m.__getitem__, 2) def test_getitem_from_array_with_operations(): @@ -561,23 +560,23 @@ def test_evaluate_with_invalid_base_value(): m = larray(range(5)) m.base_value = "foo" - assert_raises(ValueError, m.evaluate) + pytest.raises(ValueError, m.evaluate) def test_partially_evaluate_with_invalid_base_value(): m = larray(range(5)) m.base_value = "foo" - assert_raises(ValueError, m._partially_evaluate, 3) + pytest.raises(ValueError, m._partially_evaluate, 3) def test_check_bounds_with_invalid_address(): m = larray([[1, 3, 5], [7, 9, 11]]) - assert_raises(TypeError, m.check_bounds, (object(), 1)) + pytest.raises(TypeError, m.check_bounds, (object(), 1)) def test_check_bounds_with_invalid_address2(): m = larray([[1, 3, 5], [7, 9, 11]]) - assert_raises(ValueError, m.check_bounds, ([], 1)) + pytest.raises(ValueError, m.check_bounds, ([], 1)) def test_partially_evaluate_constant_array_with_one_element(): @@ -587,18 +586,18 @@ a1 = 3 * np.ones((1, 1)) m2 = larray(3, shape=(1, 1, 1)) a2 = 3 * np.ones((1, 1, 1)) - assert_equal(a[0], m[0]) - assert_equal(a.shape, m.shape) - assert_equal(a[:].shape, m[:].shape) - assert_equal(a, m.evaluate()) - assert_equal(a1.shape, m1.shape) - assert_equal(a1[0,:].shape, m1[0,:].shape) - assert_equal(a1[:].shape, m1[:].shape) - assert_equal(a1, m1.evaluate()) - assert_equal(a2.shape, m2.shape) - assert_equal(a2[:, 0,:].shape, m2[:, 0,:].shape) - assert_equal(a2[:].shape, m2[:].shape) - assert_equal(a2, m2.evaluate()) + assert a[0] == m[0] + assert a.shape == m.shape + assert a[:].shape == m[:].shape + assert a == m.evaluate() + assert a1.shape == m1.shape + assert a1[0, :].shape == m1[0, :].shape + assert a1[:].shape == m1[:].shape + assert a1 == m1.evaluate() + assert a2.shape == m2.shape + assert a2[:, 0, :].shape == m2[:, 0, :].shape + assert a2[:].shape == m2[:].shape + assert a2 == m2.evaluate() def test_partially_evaluate_constant_array_with_boolean_index(): @@ -606,24 +605,24 @@ a = 3 * np.ones((4, 5)) addr_bool = np.array([True, True, False, False, True]) addr_int = np.array([0, 1, 4]) - assert_equal(a[::2, addr_bool].shape, a[::2, addr_int].shape) - assert_equal(a[::2, addr_int].shape, m[::2, addr_int].shape) - assert_equal(a[::2, addr_bool].shape, m[::2, addr_bool].shape) + assert a[::2, addr_bool].shape == a[::2, addr_int].shape + assert a[::2, addr_int].shape == m[::2, addr_int].shape + assert a[::2, addr_bool].shape == m[::2, addr_bool].shape def test_partially_evaluate_constant_array_with_all_boolean_indices_false(): m = larray(3, shape=(3,)) a = 3 * np.ones((3,)) addr_bool = np.array([False, False, False]) - assert_equal(a[addr_bool].shape, m[addr_bool].shape) + assert a[addr_bool].shape == m[addr_bool].shape def test_partially_evaluate_constant_array_with_only_one_boolean_indice_true(): m = larray(3, shape=(3,)) a = 3 * np.ones((3,)) addr_bool = np.array([False, True, False]) - assert_equal(a[addr_bool].shape, m[addr_bool].shape) - assert_equal(m[addr_bool][0], a[0]) + assert a[addr_bool].shape == m[addr_bool].shape + assert m[addr_bool][0] == a[0] def test_partially_evaluate_constant_array_with_boolean_indice_as_random_valid_ndarray(): @@ -633,8 +632,8 @@ while not addr_bool.any(): # random array, but not [False, False, False] addr_bool = np.random.rand(3) > 0.5 - assert_equal(a[addr_bool].shape, m[addr_bool].shape) - assert_equal(m[addr_bool][0], a[addr_bool][0]) + assert a[addr_bool].shape == m[addr_bool].shape + assert m[addr_bool][0] == a[addr_bool][0] def test_partially_evaluate_constant_array_size_one_with_boolean_index_true(): @@ -644,19 +643,19 @@ m1 = larray(3, shape=(1, 1)) a1 = 3 * np.ones((1, 1)) addr_bool1 = np.array([[True]], ndmin=2) - assert_equal(m[addr_bool][0], a[0]) - assert_equal(m[addr_bool], a[addr_bool]) - assert_equal(m[addr_bool].shape, a[addr_bool].shape) - assert_equal(m1[addr_bool1][0], a1[addr_bool1][0]) - assert_equal(m1[addr_bool1].shape, a1[addr_bool1].shape) + assert m[addr_bool][0] == a[0] + assert m[addr_bool] == a[addr_bool] + assert m[addr_bool].shape == a[addr_bool].shape + assert m1[addr_bool1][0] == a1[addr_bool1][0] + assert m1[addr_bool1].shape == a1[addr_bool1].shape def test_partially_evaluate_constant_array_size_two_with_boolean_index_true(): m2 = larray(3, shape=(1, 2)) a2 = 3 * np.ones((1, 2)) addr_bool2 = np.ones((1, 2), dtype=bool) - assert_equal(m2[addr_bool2][0], a2[addr_bool2][0]) - assert_equal(m2[addr_bool2].shape, a2[addr_bool2].shape) + assert m2[addr_bool2][0] == a2[addr_bool2][0] + assert m2[addr_bool2].shape == a2[addr_bool2].shape def test_partially_evaluate_constant_array_size_one_with_boolean_index_false(): @@ -667,16 +666,16 @@ addr_bool = np.array([False]) addr_bool1 = np.array([[False]], ndmin=2) addr_bool2 = np.array([False]) - assert_equal(m[addr_bool].shape, a[addr_bool].shape) - assert_equal(m1[addr_bool1].shape, a1[addr_bool1].shape) + assert m[addr_bool].shape == a[addr_bool].shape + assert m1[addr_bool1].shape == a1[addr_bool1].shape def test_partially_evaluate_constant_array_size_with_empty_boolean_index(): m = larray(3, shape=(1,)) a = np.array([3]) addr_bool = np.array([], dtype='bool') - assert_equal(m[addr_bool].shape, a[addr_bool].shape) - assert_equal(m[addr_bool].shape, (0,)) + assert m[addr_bool].shape == a[addr_bool].shape + assert m[addr_bool].shape == (0,) def test_partially_evaluate_functional_array_with_boolean_index(): @@ -684,9 +683,9 @@ a = np.arange(20.0).reshape((4, 5)) addr_bool = np.array([True, True, False, False, True]) addr_int = np.array([0, 1, 4]) - assert_equal(a[::2, addr_bool].shape, a[::2, addr_int].shape) - assert_equal(a[::2, addr_int].shape, m[::2, addr_int].shape) - assert_equal(a[::2, addr_bool].shape, m[::2, addr_bool].shape) + assert a[::2, addr_bool].shape == a[::2, addr_int].shape + assert a[::2, addr_int].shape == m[::2, addr_int].shape + assert a[::2, addr_bool].shape == m[::2, addr_bool].shape def test_getslice_with_vectorized_iterable(): @@ -699,7 +698,7 @@ def test_equality_with_lazyarray(): m1 = larray(42.0, shape=(4, 5)) / 23.0 + 2.0 m2 = larray(42.0, shape=(4, 5)) / 23.0 + 2.0 - assert_equal(m1, m2) + assert m1 == m2 def test_equality_with_number(): @@ -707,16 +706,16 @@ m2 = larray([42, 42, 42]) m3 = larray([42, 42, 43]) m4 = larray(42.0, shape=(4, 5)) + 2 - assert_equal(m1, 42.0) - assert_equal(m2, 42) - assert_not_equal(m3, 42) - assert_raises(Exception, m4.__eq__, 44.0) + assert m1 == 42.0 + assert m2 == 42 + assert m3 != 42 + pytest.raises(Exception, m4.__eq__, 44.0) def test_equality_with_array(): m1 = larray(42.0, shape=(4, 5)) target = 42.0 * np.ones((4, 5)) - assert_raises(TypeError, m1.__eq__, target) + pytest.raises(TypeError, m1.__eq__, target) def test_deepcopy(): @@ -724,8 +723,8 @@ m2 = deepcopy(m1) m1.shape = (3, 4) m3 = deepcopy(m1) - assert_equal(m1.shape, m3.shape, (3, 4)) - assert_equal(m2.shape, (4, 5)) + assert m1.shape == m3.shape == (3, 4) + assert m2.shape == (4, 5) assert_array_equal(m1.evaluate(), m3.evaluate()) @@ -739,7 +738,7 @@ def test_set_shape(): m = larray(42) + larray(lambda i: 3 * i) - assert_equal(m.shape, None) + assert m.shape is None m.shape = (5,) assert_array_equal(m.evaluate(), np.array([42, 45, 48, 51, 54])) @@ -798,8 +797,8 @@ b = larray(np.arange(12).reshape((4, 3))) mask1 = (slice(None), int(True)) mask2 = (slice(None), np.array([int(True)])) - assert_equal(b[mask1].shape, partial_shape(mask1, b.shape), a[mask1].shape) - assert_equal(b[mask2].shape, partial_shape(mask2, b.shape), a[mask2].shape) + assert b[mask1].shape == partial_shape(mask1, b.shape) == a[mask1].shape + assert b[mask2].shape == partial_shape(mask2, b.shape) == a[mask2].shape def test__issue3(): @@ -837,15 +836,15 @@ (np.array([], bool), (0, 3)), ] for mask, expected_shape in test_cases: - assert_equal(partial_shape(mask, a.shape), a[mask].shape) - assert_equal(partial_shape(mask, a.shape), expected_shape) + assert partial_shape(mask, a.shape) == a[mask].shape + assert partial_shape(mask, a.shape) == expected_shape b = np.arange(5) test_cases = [ (np.arange(5), (5,)) ] for mask, expected_shape in test_cases: - assert_equal(partial_shape(mask, b.shape), b[mask].shape) - assert_equal(partial_shape(mask, b.shape), expected_shape) + assert partial_shape(mask, b.shape) == b[mask].shape + assert partial_shape(mask, b.shape) == expected_shape def test_is_homogeneous(): m0 = larray(10, shape=(5,)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lazyarray-0.5.0/test/test_ufunc.py new/lazyarray-0.5.2/test/test_ufunc.py --- old/lazyarray-0.5.0/test/test_ufunc.py 2021-11-09 13:29:27.532858100 +0100 +++ new/lazyarray-0.5.2/test/test_ufunc.py 2022-01-24 17:23:18.964036500 +0100 @@ -1,14 +1,13 @@ """ Unit tests for ``larray``-compatible ufuncs -Copyright Andrew P. Davison, 2012-2017 +Copyright Andrew P. Davison, 2012-2022 """ from lazyarray import larray, sqrt, cos, power, fmod import numpy as np from numpy.testing import assert_array_equal, assert_array_almost_equal -from nose.tools import assert_raises - +import pytest def test_sqrt_from_array(): A = larray(np.array([1, 4, 9, 16, 25])) @@ -59,4 +58,4 @@ def test_fmod_with_array_as_2nd_arg(): A = larray(np.array([1, 4, 9, 16, 25])) B = larray(np.array([1, 4, 9, 16, 25])) - assert_raises(TypeError, fmod, A, B) + pytest.raises(TypeError, fmod, A, B)