Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pydash for openSUSE:Factory checked in at 2023-10-17 20:24:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pydash (Old) and /work/SRC/openSUSE:Factory/.python-pydash.new.20540 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pydash" Tue Oct 17 20:24:07 2023 rev:3 rq:1117989 version:6.0.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pydash/python-pydash.changes 2022-04-08 00:29:06.625383169 +0200 +++ /work/SRC/openSUSE:Factory/.python-pydash.new.20540/python-pydash.changes 2023-10-17 20:24:08.465481431 +0200 @@ -1,0 +2,30 @@ +Mon Oct 16 10:07:57 UTC 2023 - John Paul Adrian Glaubitz <adrian.glaub...@suse.com> + +- Update to version 6.0.2 + * Only prevent access to object paths containing ``__globals__`` or + ``__builtins__`` instead of all dunder-methods for non-dict/list + objects. +- from version 6.0.1 + * Fix exception raised due to mishandling of non-string keys in functions + like ``get()`` for non-dict/list objects that used integer index references + like ``"[0]"``. +- from version 6.0.0 + * Prevent access to object paths containing dunder-methods in functions like + ``get()`` for non-dict/list objects. Attempting to access dunder-methods + using get-path keys will raise a ``KeyError`` (e.g. ``get(SomeClass(), + '__init__'`` will raise). Access to dict keys are unaffected (e.g. + ``get({"__init__": True}, "__init__")`` will return ``True``). + (**breaking change**) + * Add support for Python 3.11. + * Drop support for Python 3.6 (**breaking change**) +- from version 5.1.2 + * Remove unnecessary type check and conversion for ``exceptions`` + argument in ``pydash.retry``. +- from version 5.1.1 + * Add support for Python 3.10. + * Fix timing assertion issue in test for ``pydash.delay`` where it could + fail on certain environments. +- Switch build system from setuptools to pyproject.toml +- Update BuildRequires from pyproject.toml + +------------------------------------------------------------------- Old: ---- pydash-5.1.0.tar.gz New: ---- pydash-6.0.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pydash.spec ++++++ --- /var/tmp/diff_new_pack.ALqM3l/_old 2023-10-17 20:24:09.125504537 +0200 +++ /var/tmp/diff_new_pack.ALqM3l/_new 2023-10-17 20:24:09.125504537 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-pydash # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,15 +18,16 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pydash -Version: 5.1.0 +Version: 6.0.2 Release: 0 Summary: The kitchen sink of Python functional utility libraries License: MIT Group: Development/Languages/Python URL: https://github.com/dgilland/pydash Source: https://files.pythonhosted.org/packages/source/p/pydash/pydash-%{version}.tar.gz +BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest} -BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros BuildArch: noarch @@ -41,10 +42,10 @@ rm tox.ini %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check ++++++ pydash-5.1.0.tar.gz -> pydash-6.0.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/CHANGELOG.rst new/pydash-6.0.2/CHANGELOG.rst --- old/pydash-5.1.0/CHANGELOG.rst 2021-10-03 02:10:12.000000000 +0200 +++ new/pydash-6.0.2/CHANGELOG.rst 2023-02-24 03:32:23.000000000 +0100 @@ -3,12 +3,45 @@ Changelog ========= +v6.0.2 (2023-02-23) +------------------- + +- Only prevent access to object paths containing ``__globals__`` or ``__builtins__`` instead of all dunder-methods for non-dict/list objects. + + +v6.0.1 (2023-02-20) +------------------- + +- Fix exception raised due to mishandling of non-string keys in functions like ``get()`` for non-dict/list objects that used integer index references like ``"[0]"``. + + +v6.0.0 (2023-01-28) +------------------- + +- Prevent access to object paths containing dunder-methods in functions like ``get()`` for non-dict/list objects. Attempting to access dunder-methods using get-path keys will raise a ``KeyError`` (e.g. ``get(SomeClass(), '__init__'`` will raise). Access to dict keys are unaffected (e.g. ``get({"__init__": True}, "__init__")`` will return ``True``). (**breaking change**) +- Add support for Python 3.11. +- Drop support for Python 3.6 (**breaking change**) + + +v5.1.2 (2022-11-30) +------------------- + +- Remove unnecessary type check and conversion for ``exceptions`` argument in ``pydash.retry``. + + +v5.1.1 (2022-09-23) +------------------- + +- Add support for Python 3.10. +- Fix timing assertion issue in test for ``pydash.delay`` where it could fail on certain environments. + v5.1.0 (2021-10-02) ------------------- - Support matches-style callbacks on non-dictionary objects that are compatible with ``pydash.get`` in functions like ``pydash.find``. + v5.0.2 (2021-07-15) ------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/PKG-INFO new/pydash-6.0.2/PKG-INFO --- old/pydash-5.1.0/PKG-INFO 2021-10-03 02:14:29.660349000 +0200 +++ new/pydash-6.0.2/PKG-INFO 2023-02-24 04:01:27.160943300 +0100 @@ -1,13 +1,12 @@ Metadata-Version: 2.1 Name: pydash -Version: 5.1.0 +Version: 6.0.2 Summary: The kitchen sink of Python utility libraries for doing "stuff" in a functional way. Based on the Lo-Dash Javascript library. Home-page: https://github.com/dgilland/pydash Author: Derrick Gilland Author-email: dgill...@gmail.com License: MIT License Keywords: pydash utility functional lodash underscore -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: License :: OSI Approved :: MIT License Classifier: Intended Audience :: Developers @@ -18,10 +17,11 @@ Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Utilities -Requires-Python: >=3.6 +Requires-Python: >=3.7 Provides-Extra: dev License-File: LICENSE.rst License-File: AUTHORS.rst @@ -65,12 +65,45 @@ Changelog ========= +v6.0.2 (2023-02-23) +------------------- + +- Only prevent access to object paths containing ``__globals__`` or ``__builtins__`` instead of all dunder-methods for non-dict/list objects. + + +v6.0.1 (2023-02-20) +------------------- + +- Fix exception raised due to mishandling of non-string keys in functions like ``get()`` for non-dict/list objects that used integer index references like ``"[0]"``. + + +v6.0.0 (2023-01-28) +------------------- + +- Prevent access to object paths containing dunder-methods in functions like ``get()`` for non-dict/list objects. Attempting to access dunder-methods using get-path keys will raise a ``KeyError`` (e.g. ``get(SomeClass(), '__init__'`` will raise). Access to dict keys are unaffected (e.g. ``get({"__init__": True}, "__init__")`` will return ``True``). (**breaking change**) +- Add support for Python 3.11. +- Drop support for Python 3.6 (**breaking change**) + + +v5.1.2 (2022-11-30) +------------------- + +- Remove unnecessary type check and conversion for ``exceptions`` argument in ``pydash.retry``. + + +v5.1.1 (2022-09-23) +------------------- + +- Add support for Python 3.10. +- Fix timing assertion issue in test for ``pydash.delay`` where it could fail on certain environments. + v5.1.0 (2021-10-02) ------------------- - Support matches-style callbacks on non-dictionary objects that are compatible with ``pydash.get`` in functions like ``pydash.find``. + v5.0.2 (2021-07-15) ------------------- @@ -1255,5 +1288,3 @@ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/docs/conf.py new/pydash-6.0.2/docs/conf.py --- old/pydash-5.1.0/docs/conf.py 2021-06-27 20:15:05.000000000 +0200 +++ new/pydash-6.0.2/docs/conf.py 2022-09-23 15:07:13.000000000 +0200 @@ -78,7 +78,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = 'en' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -191,4 +191,3 @@ # -- Extension configuration ------------------------------------------------- - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/pyproject.toml new/pydash-6.0.2/pyproject.toml --- old/pydash-5.1.0/pyproject.toml 2021-06-27 20:15:05.000000000 +0200 +++ new/pydash-6.0.2/pyproject.toml 2022-09-23 14:58:40.000000000 +0200 @@ -1,8 +1,9 @@ [build-system] requires = [ - "setuptools>=46.4", - "wheel", + "setuptools>=46.4", + "wheel", ] +build-backend = "setuptools.build_meta" [tool.black] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/setup.cfg new/pydash-6.0.2/setup.cfg --- old/pydash-5.1.0/setup.cfg 2021-10-03 02:14:29.664765000 +0200 +++ new/pydash-6.0.2/setup.cfg 2023-02-24 04:01:27.162047400 +0100 @@ -19,6 +19,7 @@ Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Topic :: Software Development :: Libraries Topic :: Software Development :: Libraries :: Python Modules Topic :: Utilities @@ -27,7 +28,7 @@ package_dir = = src packages = find: -python_requires = >=3.6 +python_requires = >=3.7 install_requires = [options.packages.find] @@ -36,19 +37,19 @@ [options.extras_require] dev = black + build coverage docformatter flake8 flake8-black flake8-bugbear flake8-isort + importlib_metadata<5; python_version=="3.7" invoke isort pylint pytest pytest-cov - pytest-flake8 - pytest-pylint Sphinx sphinx-rtd-theme tox @@ -74,6 +75,8 @@ [tool:pytest] junit_family = xunit2 +filterwarnings = + ignore::pytest.PytestRemovedIn8Warning:pytest_pylint.* addopts = --verbose --doctest-modules diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/setup.py new/pydash-6.0.2/setup.py --- old/pydash-5.1.0/setup.py 2021-06-27 20:15:05.000000000 +0200 +++ new/pydash-6.0.2/setup.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -#!/usr/bin/env python - -from setuptools import setup - - -setup() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/src/pydash/__init__.py new/pydash-6.0.2/src/pydash/__init__.py --- old/pydash-5.1.0/src/pydash/__init__.py 2021-10-03 02:10:12.000000000 +0200 +++ new/pydash-6.0.2/src/pydash/__init__.py 2023-02-24 03:55:13.000000000 +0100 @@ -1,6 +1,6 @@ """Python port of Lo-Dash.""" -__version__ = "5.1.0" +__version__ = "6.0.2" from .arrays import ( chunk, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/src/pydash/helpers.py new/pydash-6.0.2/src/pydash/helpers.py --- old/pydash-5.1.0/src/pydash/helpers.py 2021-09-28 23:40:18.000000000 +0200 +++ new/pydash-6.0.2/src/pydash/helpers.py 2023-02-24 03:26:36.000000000 +0100 @@ -20,6 +20,9 @@ #: Dictionary of builtins with keys as the builtin function and values as the string name. BUILTINS = {value: key for key, value in builtins.__dict__.items() if isinstance(value, Hashable)} +#: Object keys that are restricted from access via path access. +RESTRICTED_KEYS = ("__globals__", "__builtins__") + def callit(iteratee, *args, **kwargs): """Inspect argspec of `iteratee` function and only pass the supported arguments when calling @@ -178,6 +181,7 @@ def _base_get_object(obj, key, default=UNSET): value = _base_get_item(obj, key, default=UNSET) if value is UNSET: + _raise_if_restricted_key(key) value = default try: value = getattr(obj, key) @@ -186,6 +190,12 @@ return value +def _raise_if_restricted_key(key): + # Prevent access to restricted keys for security reasons. + if key in RESTRICTED_KEYS: + raise KeyError(f"access to restricted key {key!r} is not allowed") + + def base_set(obj, key, value, allow_override=True): """ Set an object's `key` to `value`. If `obj` is a ``list`` and the `key` is the next available @@ -213,6 +223,7 @@ obj[:] = (obj + [None] * key)[:key] obj.append(value) elif (allow_override or not hasattr(obj, key)) and obj is not None: + _raise_if_restricted_key(key) setattr(obj, key, value) return obj diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/src/pydash/objects.py new/pydash-6.0.2/src/pydash/objects.py --- old/pydash-5.1.0/src/pydash/objects.py 2021-09-28 23:40:18.000000000 +0200 +++ new/pydash-6.0.2/src/pydash/objects.py 2023-02-16 03:13:09.000000000 +0100 @@ -1081,7 +1081,7 @@ properties (str): Property values to pick. Returns: - dict: Dict containg picked properties. + dict: Dict containing picked properties. Example: @@ -1106,7 +1106,7 @@ iteratee (mixed, optional): Iteratee used to determine which properties to pick. Returns: - dict: Dict containg picked properties. + dict: Dict containing picked properties. Example: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/src/pydash/predicates.py new/pydash-6.0.2/src/pydash/predicates.py --- old/pydash-5.1.0/src/pydash/predicates.py 2021-09-28 23:31:52.000000000 +0200 +++ new/pydash-6.0.2/src/pydash/predicates.py 2022-09-23 15:22:37.000000000 +0200 @@ -268,7 +268,8 @@ def is_blank(text): - r"""Checks if `text` contains only whitespace characters. + r""" + Checks if `text` contains only whitespace characters. Args: text (str): String to test. @@ -535,9 +536,9 @@ and len(value) == len(other) ): # Walk a/b to determine equality using customizer. - for key, value in iterator(value): + for key, val in iterator(value): if pyd.has(other, key): - equal = is_equal_with(value, other[key], customizer) + equal = is_equal_with(val, other[key], customizer) else: equal = False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/src/pydash/strings.py new/pydash-6.0.2/src/pydash/strings.py --- old/pydash-5.1.0/src/pydash/strings.py 2021-06-27 20:15:05.000000000 +0200 +++ new/pydash-6.0.2/src/pydash/strings.py 2022-09-23 15:31:18.000000000 +0200 @@ -781,7 +781,8 @@ def lines(text): - r"""Split lines in `text` into an array. + r""" + Split lines in `text` into an array. Args: text (str): String to split. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/src/pydash/utilities.py new/pydash-6.0.2/src/pydash/utilities.py --- old/pydash-5.1.0/src/pydash/utilities.py 2021-06-27 20:15:05.000000000 +0200 +++ new/pydash-6.0.2/src/pydash/utilities.py 2022-12-01 05:56:26.000000000 +0100 @@ -631,8 +631,8 @@ else: # pragma: no cover # PY26 seconds = ( - delta.microseconds + (delta.seconds + delta.days * 24 * 3600) * 10 ** 6 - ) / 10 ** 6 + delta.microseconds + (delta.seconds + delta.days * 24 * 3600) * 10**6 + ) / 10**6 return int(seconds * 1000) @@ -997,9 +997,6 @@ ..versionchanged:: 4.5.0 Added ``jitter`` argument. """ - if isinstance(exceptions, Exception): # pragma: no cover - exceptions = (exceptions,) - if not isinstance(attempts, int) or attempts <= 0: raise ValueError("attempts must be an integer greater than 0") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/src/pydash.egg-info/PKG-INFO new/pydash-6.0.2/src/pydash.egg-info/PKG-INFO --- old/pydash-5.1.0/src/pydash.egg-info/PKG-INFO 2021-10-03 02:14:28.000000000 +0200 +++ new/pydash-6.0.2/src/pydash.egg-info/PKG-INFO 2023-02-24 04:01:27.000000000 +0100 @@ -1,13 +1,12 @@ Metadata-Version: 2.1 Name: pydash -Version: 5.1.0 +Version: 6.0.2 Summary: The kitchen sink of Python utility libraries for doing "stuff" in a functional way. Based on the Lo-Dash Javascript library. Home-page: https://github.com/dgilland/pydash Author: Derrick Gilland Author-email: dgill...@gmail.com License: MIT License Keywords: pydash utility functional lodash underscore -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: License :: OSI Approved :: MIT License Classifier: Intended Audience :: Developers @@ -18,10 +17,11 @@ Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Utilities -Requires-Python: >=3.6 +Requires-Python: >=3.7 Provides-Extra: dev License-File: LICENSE.rst License-File: AUTHORS.rst @@ -65,12 +65,45 @@ Changelog ========= +v6.0.2 (2023-02-23) +------------------- + +- Only prevent access to object paths containing ``__globals__`` or ``__builtins__`` instead of all dunder-methods for non-dict/list objects. + + +v6.0.1 (2023-02-20) +------------------- + +- Fix exception raised due to mishandling of non-string keys in functions like ``get()`` for non-dict/list objects that used integer index references like ``"[0]"``. + + +v6.0.0 (2023-01-28) +------------------- + +- Prevent access to object paths containing dunder-methods in functions like ``get()`` for non-dict/list objects. Attempting to access dunder-methods using get-path keys will raise a ``KeyError`` (e.g. ``get(SomeClass(), '__init__'`` will raise). Access to dict keys are unaffected (e.g. ``get({"__init__": True}, "__init__")`` will return ``True``). (**breaking change**) +- Add support for Python 3.11. +- Drop support for Python 3.6 (**breaking change**) + + +v5.1.2 (2022-11-30) +------------------- + +- Remove unnecessary type check and conversion for ``exceptions`` argument in ``pydash.retry``. + + +v5.1.1 (2022-09-23) +------------------- + +- Add support for Python 3.10. +- Fix timing assertion issue in test for ``pydash.delay`` where it could fail on certain environments. + v5.1.0 (2021-10-02) ------------------- - Support matches-style callbacks on non-dictionary objects that are compatible with ``pydash.get`` in functions like ``pydash.find``. + v5.0.2 (2021-07-15) ------------------- @@ -1255,5 +1288,3 @@ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/src/pydash.egg-info/SOURCES.txt new/pydash-6.0.2/src/pydash.egg-info/SOURCES.txt --- old/pydash-5.1.0/src/pydash.egg-info/SOURCES.txt 2021-10-03 02:14:29.000000000 +0200 +++ new/pydash-6.0.2/src/pydash.egg-info/SOURCES.txt 2023-02-24 04:01:27.000000000 +0100 @@ -8,7 +8,6 @@ pyproject.toml requirements.txt setup.cfg -setup.py tasks.py tox.ini docs/Makefile @@ -51,7 +50,8 @@ src/pydash.egg-info/requires.txt src/pydash.egg-info/top_level.txt tests/__init__.py -tests/fixtures.py +tests/conftest.py +tests/helpers.py tests/test_annotations.py tests/test_arrays.py tests/test_chaining.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/src/pydash.egg-info/requires.txt new/pydash-6.0.2/src/pydash.egg-info/requires.txt --- old/pydash-5.1.0/src/pydash.egg-info/requires.txt 2021-10-03 02:14:28.000000000 +0200 +++ new/pydash-6.0.2/src/pydash.egg-info/requires.txt 2023-02-24 04:01:27.000000000 +0100 @@ -1,6 +1,7 @@ [dev] black +build coverage docformatter flake8 @@ -12,10 +13,11 @@ pylint pytest pytest-cov -pytest-flake8 -pytest-pylint Sphinx sphinx-rtd-theme tox twine wheel + +[dev:python_version == "3.7"] +importlib_metadata<5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/tasks.py new/pydash-6.0.2/tasks.py --- old/pydash-5.1.0/tasks.py 2021-07-16 01:20:16.000000000 +0200 +++ new/pydash-6.0.2/tasks.py 2023-01-29 02:19:32.000000000 +0100 @@ -77,6 +77,8 @@ linters = {"flake8": flake8, "pylint": pylint} failures = [] + print(f"Preparing to run linters: {', '.join(linters)}\n") + for name, linter in linters.items(): print(f"Running {name}") try: @@ -90,11 +92,11 @@ if failures: failed = ", ".join(failures) - raise Exit(f"ERROR: Linters that failed: {failed}") + raise Exit(f"ERROR: linters failed: {failed}") @task(help={"args": "Override default pytest arguments"}) -def unit(ctx, args=f"{TEST_TARGETS} --cov={PACKAGE_NAME} --flake8 --pylint"): +def test(ctx, args=f"{TEST_TARGETS} --cov={PACKAGE_NAME}"): """Run unit tests using pytest.""" tox_env_site_packages_dir = os.getenv("TOX_ENV_SITE_PACKAGES_DIR") if tox_env_site_packages_dir: @@ -106,7 +108,7 @@ @task -def test(ctx): +def ci(ctx): """Run linters and tests.""" print("Building package") build(ctx) @@ -118,7 +120,7 @@ lint(ctx) print("Running unit tests") - unit(ctx, args=f"{TEST_TARGETS} --cov={PACKAGE_NAME}") + test(ctx) @task @@ -136,7 +138,7 @@ def build(ctx): """Build Python package.""" run("rm -rf dist build docs/_build") - run("python setup.py -q sdist bdist_wheel") + run("python -m build") @task diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/tests/build/testresults/junit.xml new/pydash-6.0.2/tests/build/testresults/junit.xml --- old/pydash-5.1.0/tests/build/testresults/junit.xml 2021-07-15 23:57:39.000000000 +0200 +++ new/pydash-6.0.2/tests/build/testresults/junit.xml 2022-09-23 15:16:59.000000000 +0200 @@ -1 +1 @@ -<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="0" skipped="0" tests="1" time="0.065" timestamp="2021-07-15T17:57:39.685388" hostname="dlg-air"><testcase classname="tests.test_chaining" name="test_invalid_method_subclasses_attribute_error" time="0.001" /></testsuite></testsuites> \ No newline at end of file +<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="0" skipped="0" tests="1" time="0.158" timestamp="2022-09-23T09:16:59.839194" hostname="dlg-air"><testcase classname="tests.test_functions" name="test_delay[<lambda>-250-args0-kwargs0-expected0]" time="0.004" /></testsuite></testsuites> \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/tests/conftest.py new/pydash-6.0.2/tests/conftest.py --- old/pydash-5.1.0/tests/conftest.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pydash-6.0.2/tests/conftest.py 2022-09-23 15:25:56.000000000 +0200 @@ -0,0 +1,9 @@ +from unittest import mock + +import pytest + + +@pytest.fixture +def mock_sleep(): + with mock.patch("time.sleep") as mocked: + yield mocked diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/tests/fixtures.py new/pydash-6.0.2/tests/fixtures.py --- old/pydash-5.1.0/tests/fixtures.py 2021-09-28 23:40:18.000000000 +0200 +++ new/pydash-6.0.2/tests/fixtures.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,88 +0,0 @@ -class Object(object): - def __init__(self, **attrs): - for key, value in attrs.items(): - setattr(self, key, value) - - -class ItemsObject(object): - def __init__(self, items): - self._items = items - - def items(self): - if isinstance(self._items, dict): - return list(self._items.items()) - else: - return enumerate(self._items) - - -class IteritemsObject(object): - def __init__(self, items): - self._items = items - - def iteritems(self): - if isinstance(self._items, dict): - for key, value in self._items.items(): - yield key, value - else: - for i, item in enumerate(self._items): - yield i, item - - -class Filter(object): - def __init__(self, predicate): - self.predicate = predicate - - def __call__(self, item): - return self.predicate(item) - - -def reduce_iteratee0(total, num): - return total + num - - -def reduce_iteratee1(result, num, key): - result[key] = num * 3 - return result - - -def reduce_right_iteratee0(a, b): - return a + b - - -def noop(*args, **kwargs): - pass - - -def transform_iteratee0(result, num): - num *= num - if num % 2: - result.append(num) - return len(result) < 3 - - -def is_equal_iteratee0(a, b): - a_greet = a.startswith("h") if hasattr(a, "startswith") else False - b_greet = b.startswith("h") if hasattr(b, "startswith") else False - - return a_greet == b_greet if a_greet or b_greet else None - - -def for_in_iteratee0(value, key, obj): - obj[key] += value - - -def for_in_iteratee1(value, key, obj): - obj[key] += value - return False - - -def for_in_iteratee2(value, index, obj): - if index == 2: - obj[index] = "index:2" - return True - elif index == 0: - obj[index] = False - return True - else: - obj[index] = True - return False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/tests/helpers.py new/pydash-6.0.2/tests/helpers.py --- old/pydash-5.1.0/tests/helpers.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pydash-6.0.2/tests/helpers.py 2022-09-23 15:11:57.000000000 +0200 @@ -0,0 +1,88 @@ +class Object(object): + def __init__(self, **attrs): + for key, value in attrs.items(): + setattr(self, key, value) + + +class ItemsObject(object): + def __init__(self, items): + self._items = items + + def items(self): + if isinstance(self._items, dict): + return list(self._items.items()) + else: + return enumerate(self._items) + + +class IteritemsObject(object): + def __init__(self, items): + self._items = items + + def iteritems(self): + if isinstance(self._items, dict): + for key, value in self._items.items(): + yield key, value + else: + for i, item in enumerate(self._items): + yield i, item + + +class Filter(object): + def __init__(self, predicate): + self.predicate = predicate + + def __call__(self, item): + return self.predicate(item) + + +def reduce_iteratee0(total, num): + return total + num + + +def reduce_iteratee1(result, num, key): + result[key] = num * 3 + return result + + +def reduce_right_iteratee0(a, b): + return a + b + + +def noop(*args, **kwargs): + pass + + +def transform_iteratee0(result, num): + num *= num + if num % 2: + result.append(num) + return len(result) < 3 + + +def is_equal_iteratee0(a, b): + a_greet = a.startswith("h") if hasattr(a, "startswith") else False + b_greet = b.startswith("h") if hasattr(b, "startswith") else False + + return a_greet == b_greet if a_greet or b_greet else None + + +def for_in_iteratee0(value, key, obj): + obj[key] += value + + +def for_in_iteratee1(value, key, obj): + obj[key] += value + return False + + +def for_in_iteratee2(value, index, obj): + if index == 2: + obj[index] = "index:2" + return True + elif index == 0: + obj[index] = False + return True + else: + obj[index] = True + return False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/tests/test_collections.py new/pydash-6.0.2/tests/test_collections.py --- old/pydash-5.1.0/tests/test_collections.py 2021-09-28 23:21:13.000000000 +0200 +++ new/pydash-6.0.2/tests/test_collections.py 2022-09-23 15:19:05.000000000 +0200 @@ -6,7 +6,7 @@ import pydash as _ -from . import fixtures +from . import helpers parametrize = pytest.mark.parametrize @@ -140,7 +140,7 @@ def test_find_class_object(): - obj = fixtures.Object(a=1, b=2) + obj = helpers.Object(a=1, b=2) assert _.find([None, {}, obj], {"b": 2}) == obj @@ -152,7 +152,7 @@ @parametrize( "case,expected", - [(({"abc": 1, "xyz": 2, "c": 3}.values(), fixtures.Filter(lambda x: x < 2)), 1)], + [(({"abc": 1, "xyz": 2, "c": 3}.values(), helpers.Filter(lambda x: x < 2)), 1)], ) def test_find_using_callable_class(case, expected): assert _.find(*case) == expected @@ -215,9 +215,9 @@ @parametrize( "case,expected", [ - (([1, 2, 3], fixtures.noop), [1, 2, 3]), + (([1, 2, 3], helpers.noop), [1, 2, 3]), (([1, 2, 3], lambda value: value < 2), [1, 2, 3]), - (({"one": 1, "two": 2, "three": 3}, fixtures.noop), {"one": 1, "two": 2, "three": 3}), + (({"one": 1, "two": 2, "three": 3}, helpers.noop), {"one": 1, "two": 2, "three": 3}), ], ) def test_for_each(case, expected): @@ -227,9 +227,9 @@ @parametrize( "case,expected", [ - (([1, 2, 3], fixtures.noop), [1, 2, 3]), + (([1, 2, 3], helpers.noop), [1, 2, 3]), (([1, 2, 3], lambda value: value < 2), [1, 2, 3]), - (({"one": 1, "two": 2, "three": 3}, fixtures.noop), {"one": 1, "two": 2, "three": 3}), + (({"one": 1, "two": 2, "three": 3}, helpers.noop), {"one": 1, "two": 2, "three": 3}), ], ) def test_for_each_right(case, expected): @@ -783,8 +783,8 @@ "case,expected", [ (([1, 2, 3], None), 1), - (([1, 2, 3], fixtures.reduce_iteratee0), 6), - (({"a": 1, "b": 2, "c": 3}, fixtures.reduce_iteratee1, {}), {"a": 3, "b": 6, "c": 9}), + (([1, 2, 3], helpers.reduce_iteratee0), 6), + (({"a": 1, "b": 2, "c": 3}, helpers.reduce_iteratee1, {}), {"a": 3, "b": 6, "c": 9}), ], ) def test_reduce_(case, expected): @@ -807,9 +807,9 @@ "case,expected", [ (([1, 2, 3], None), 3), - (([1, 2, 3], fixtures.reduce_iteratee0), 6), - (([[0, 1], [2, 3], [4, 5]], fixtures.reduce_right_iteratee0), [4, 5, 2, 3, 0, 1]), - (({"a": 1, "b": 2, "c": 3}, fixtures.reduce_iteratee1, {}), {"a": 3, "b": 6, "c": 9}), + (([1, 2, 3], helpers.reduce_iteratee0), 6), + (([[0, 1], [2, 3], [4, 5]], helpers.reduce_right_iteratee0), [4, 5, 2, 3, 0, 1]), + (({"a": 1, "b": 2, "c": 3}, helpers.reduce_iteratee1, {}), {"a": 3, "b": 6, "c": 9}), ], ) def test_reduce_right(case, expected): @@ -832,8 +832,8 @@ "case,expected", [ (([1, 2, 3], None), [1, 1]), - (([1, 2, 3], fixtures.reduce_iteratee0), [3, 6]), - (([1, 2, 3, 4, 5], fixtures.reduce_iteratee0, 0), [1, 3, 6, 10, 15]), + (([1, 2, 3], helpers.reduce_iteratee0), [3, 6]), + (([1, 2, 3, 4, 5], helpers.reduce_iteratee0, 0), [1, 3, 6, 10, 15]), ], ) def test_reductions(case, expected): @@ -844,9 +844,9 @@ "case,expected", [ (([1, 2, 3], None), [3, 3]), - (([1, 2, 3], fixtures.reduce_iteratee0), [5, 6]), + (([1, 2, 3], helpers.reduce_iteratee0), [5, 6]), ( - ([[0, 1], [2, 3], [4, 5]], fixtures.reduce_right_iteratee0), + ([[0, 1], [2, 3], [4, 5]], helpers.reduce_right_iteratee0), [[4, 5, 2, 3], [4, 5, 2, 3, 0, 1]], ), ], @@ -1014,10 +1014,10 @@ [ (("cat",), ["c", "a", "t"]), ((b"cat",), ["c", "a", "t"]), - ((u"cat",), [u"c", u"a", u"t"]), + (("cat",), ["c", "a", "t"]), (("cat", False), ["cat"]), ((b"cat", False), [b"cat"]), - ((u"cat", False), [u"cat"]), + (("cat", False), ["cat"]), (({"a": 1, "b": 2, "c": 3},), [1, 2, 3]), ], ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/tests/test_functions.py new/pydash-6.0.2/tests/test_functions.py --- old/pydash-5.1.0/tests/test_functions.py 2021-09-28 23:43:01.000000000 +0200 +++ new/pydash-6.0.2/tests/test_functions.py 2022-09-23 15:25:56.000000000 +0200 @@ -9,12 +9,6 @@ parametrize = pytest.mark.parametrize -@pytest.fixture -def mocked_sleep(): - with mock.patch("time.sleep") as mocked: - yield mocked - - @parametrize( "case,expected", [ @@ -184,13 +178,10 @@ "func,wait,args,kwargs,expected", [(lambda a, b, c: (a, b, c), 250, (1, 2), {"c": 3}, (1, 2, 3))], ) -def test_delay(func, wait, args, kwargs, expected): - start = time.time() * 1000 +def test_delay(mock_sleep, func, wait, args, kwargs, expected): result = _.delay(func, wait, *args, **kwargs) - stop = time.time() * 1000 - - assert (wait - 10) <= (stop - start) <= (wait + 10) assert result == expected + assert mock_sleep.call_args_list == [mock.call(pytest.approx(wait / 1000.0))] @parametrize( @@ -289,8 +280,8 @@ @parametrize( "func,transforms,args,expected", [ - (lambda a, b: [a, b], [lambda x: x ** 2, lambda x: x * 2], (5, 10), [25, 20]), - (lambda a, b: [a, b], ([lambda x: x ** 2, lambda x: x * 2],), (5, 10), [25, 20]), + (lambda a, b: [a, b], [lambda x: x**2, lambda x: x * 2], (5, 10), [25, 20]), + (lambda a, b: [a, b], ([lambda x: x**2, lambda x: x * 2],), (5, 10), [25, 20]), ], ) def test_over_args(func, transforms, args, expected): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/tests/test_objects.py new/pydash-6.0.2/tests/test_objects.py --- old/pydash-5.1.0/tests/test_objects.py 2021-06-27 20:15:07.000000000 +0200 +++ new/pydash-6.0.2/tests/test_objects.py 2023-02-24 03:30:12.000000000 +0100 @@ -6,7 +6,7 @@ import pydash as _ -from . import fixtures +from . import helpers parametrize = pytest.mark.parametrize @@ -288,14 +288,14 @@ "case,expected", [ ( - ({"name": "fred", "employer": "slate"}, fixtures.for_in_iteratee0), + ({"name": "fred", "employer": "slate"}, helpers.for_in_iteratee0), ({"name": "fredfred", "employer": "slateslate"},), ), ( - ({"name": "fred", "employer": "slate"}, fixtures.for_in_iteratee1), + ({"name": "fred", "employer": "slate"}, helpers.for_in_iteratee1), ({"name": "fredfred", "employer": "slate"}, {"name": "fred", "employer": "slateslate"}), ), - (([1, 2, 3], fixtures.for_in_iteratee2), ([False, True, 3],)), + (([1, 2, 3], helpers.for_in_iteratee2), ([False, True, 3],)), ], ) def test_for_in(case, expected): @@ -306,14 +306,14 @@ "case,expected", [ ( - ({"name": "fred", "employer": "slate"}, fixtures.for_in_iteratee0), + ({"name": "fred", "employer": "slate"}, helpers.for_in_iteratee0), ({"name": "fredfred", "employer": "slateslate"},), ), ( - ({"name": "fred", "employer": "slate"}, fixtures.for_in_iteratee1), + ({"name": "fred", "employer": "slate"}, helpers.for_in_iteratee1), ({"name": "fredfred", "employer": "slate"}, {"name": "fred", "employer": "slateslate"}), ), - (([1, 2, 3], fixtures.for_in_iteratee2), ([1, True, "index:2"],)), + (([1, 2, 3], helpers.for_in_iteratee2), ([1, True, "index:2"],)), ], ) def test_for_in_right(case, expected): @@ -368,6 +368,7 @@ (({object: 1}, object), 1), (({object: {object: 1}}, [object, object]), 1), (({1: {"name": "John Doe"}}, "1.name"), "John Doe"), + ((helpers.Object(), "[0].field"), None), ], ) def test_get(case, expected): @@ -381,6 +382,45 @@ @parametrize( + "obj,path", + [ + (helpers.Object(), "__init__.__globals__"), + (namedtuple("a", ["a"])(a=1), "__globals__"), + (helpers.Object(subobj=helpers.Object()), "subobj.__builtins__"), + (helpers.Object(subobj=helpers.Object()), "__builtins__"), + ], +) +def test_get__raises_for_objects_when_path_restricted(obj, path): + with pytest.raises(KeyError, match="access to restricted key"): + _.get(obj, path) + + +@parametrize( + "obj,path", + [ + ({}, "__globals__"), + ({}, "__builtins__"), + ([], "__globals__"), + ([], "__builtins__"), + ], +) +def test_get__does_not_raise_for_dict_or_list_when_path_restricted(obj, path): + assert _.get(obj, path) is None + + +@parametrize( + "obj,path", + [ + (helpers.Object(), "__name__"), + (helpers.Object(), "foo.__dict__"), + (helpers.Object(), "__len__"), + ], +) +def test_get__does_not_raise_for_objects_when_path_is_unrestricted(obj, path): + assert _.get(obj, path) is None + + +@parametrize( "case,expected", [ (({"a": 1, "b": 2, "c": 3}, "b"), True), @@ -644,9 +684,9 @@ (({"a": 1, "b": 2, "c": 3}, ["a"], ["b"]), {"a": 1, "b": 2}), (([1, 2, 3],), {}), (([1, 2, 3], 0), {0: 1}), - ((fixtures.Object(a=1, b=2, c=3), "a"), {"a": 1}), - ((fixtures.ItemsObject({"a": 1, "b": 2, "c": 3}), "a"), {"a": 1}), - ((fixtures.IteritemsObject({"a": 1, "b": 2, "c": 3}), "a"), {"a": 1}), + ((helpers.Object(a=1, b=2, c=3), "a"), {"a": 1}), + ((helpers.ItemsObject({"a": 1, "b": 2, "c": 3}), "a"), {"a": 1}), + ((helpers.IteritemsObject({"a": 1, "b": 2, "c": 3}), "a"), {"a": 1}), (({"a": {"b": 1, "c": 2, "d": 3}}, "a.b", "a.d"), {"a": {"b": 1, "d": 3}}), ( ({"a": [{"b": 1}, {"c": 2}, {"d": 3}]}, "a[0]", "a[2]"), @@ -665,9 +705,9 @@ (({"a": 1, "b": 2, "c": 3}, lambda value, key: key in ["a"]), {"a": 1}), (([1, 2, 3],), {0: 1, 1: 2, 2: 3}), (([1, 2, 3], [0]), {0: 1}), - ((fixtures.Object(a=1, b=2, c=3), "a"), {"a": 1}), - ((fixtures.ItemsObject({"a": 1, "b": 2, "c": 3}), "a"), {"a": 1}), - ((fixtures.IteritemsObject({"a": 1, "b": 2, "c": 3}), "a"), {"a": 1}), + ((helpers.Object(a=1, b=2, c=3), "a"), {"a": 1}), + ((helpers.ItemsObject({"a": 1, "b": 2, "c": 3}), "a"), {"a": 1}), + ((helpers.IteritemsObject({"a": 1, "b": 2, "c": 3}), "a"), {"a": 1}), ], ) def test_pick_by(case, expected): @@ -824,7 +864,7 @@ ([1, 2, 3, 4, 5], lambda acc, value, key: acc.append((key, value))), [(0, 1), (1, 2), (2, 3), (3, 4), (4, 5)], ), - (([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], fixtures.transform_iteratee0), [1, 9, 25]), + (([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], helpers.transform_iteratee0), [1, 9, 25]), (([1, 2, 3, 4, 5],), []), ], ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/tests/test_predicates.py new/pydash-6.0.2/tests/test_predicates.py --- old/pydash-5.1.0/tests/test_predicates.py 2021-06-27 20:15:05.000000000 +0200 +++ new/pydash-6.0.2/tests/test_predicates.py 2022-09-23 15:19:37.000000000 +0200 @@ -7,7 +7,7 @@ import pydash as _ -from . import fixtures +from . import helpers parametrize = pytest.mark.parametrize @@ -250,7 +250,7 @@ (([1, 2], [1, 2, 3], None), False), (([1, 2, 3], [1, 2], lambda a, b: None if isinstance(a, list) else True), False), (([1, 2], [1, 2, 3], lambda a, b: None if isinstance(a, list) else True), False), - ((["hello", "goodbye"], ["hi", "goodbye"], fixtures.is_equal_iteratee0), True), + ((["hello", "goodbye"], ["hi", "goodbye"], helpers.is_equal_iteratee0), True), ], ) def test_is_equal_with(case, expected): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/tests/test_strings.py new/pydash-6.0.2/tests/test_strings.py --- old/pydash-5.1.0/tests/test_strings.py 2021-09-28 23:40:18.000000000 +0200 +++ new/pydash-6.0.2/tests/test_strings.py 2022-05-16 00:03:39.000000000 +0200 @@ -788,7 +788,7 @@ [ ("Foo Bar", "foo-bar"), (" foo bar ", "foo-bar"), - (u"Un éléphant à l'orée du bois", "un-elephant-a-l-oree-du-bois"), + ("Un éléphant à l'orée du bois", "un-elephant-a-l-oree-du-bois"), ("", ""), (5, "5"), (None, ""), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/tests/test_utilities.py new/pydash-6.0.2/tests/test_utilities.py --- old/pydash-5.1.0/tests/test_utilities.py 2021-09-28 23:40:18.000000000 +0200 +++ new/pydash-6.0.2/tests/test_utilities.py 2023-01-28 18:29:56.000000000 +0100 @@ -9,12 +9,6 @@ parametrize = pytest.mark.parametrize -@pytest.fixture -def mocked_sleep(): - with mock.patch("time.sleep") as mocked: - yield mocked - - @parametrize("case,expected", [((lambda a, b: a / b, 4, 2), 2)]) def test_attempt(case, expected): assert _.attempt(*case) == expected @@ -472,25 +466,25 @@ ({"attempts": 5, "delay": 1.5, "max_delay": 8.0, "scale": 2.5}, 4, [1.5, 3.75, 8.0, 8.0]), ], ) -def test_retry(mocked_sleep, case, delay_count, delay_times): +def test_retry(mock_sleep, case, delay_count, delay_times): @_.retry(**case) def func(): - raise Exception() + raise KeyError() - with pytest.raises(Exception): + with pytest.raises(KeyError): func() - assert delay_count == mocked_sleep.call_count + assert delay_count == mock_sleep.call_count delay_calls = [mock.call(time) for time in delay_times] - assert delay_calls == mocked_sleep.call_args_list + assert delay_calls == mock_sleep.call_args_list @parametrize( "case,delay_count", [({"attempts": 3}, 0), ({"attempts": 3}, 1), ({"attempts": 3}, 2), ({"attempts": 5}, 3)], ) -def test_retry_success(mocked_sleep, case, delay_count): +def test_retry_success(mock_sleep, case, delay_count): counter = {True: 0} @_.retry(**case) @@ -504,7 +498,7 @@ assert result is True assert counter[True] == delay_count - assert delay_count == mocked_sleep.call_count + assert delay_count == mock_sleep.call_count @parametrize( @@ -515,18 +509,18 @@ ({"jitter": 1.0, "delay": 3, "scale": 1.5, "attempts": 5}, [3, 4.5, 6.75, 10.125]), ], ) -def test_retry_jitter(mocked_sleep, case, unexpected_delay_times): +def test_retry_jitter(mock_sleep, case, unexpected_delay_times): @_.retry(**case) def func(): - raise Exception() + raise ValueError() - with pytest.raises(Exception): + with pytest.raises(ValueError): func() unexpected_delay_calls = [mock.call(time) for time in unexpected_delay_times] - assert len(unexpected_delay_calls) == mocked_sleep.call_count - assert unexpected_delay_calls != mocked_sleep.call_args_list + assert len(unexpected_delay_calls) == mock_sleep.call_count + assert unexpected_delay_calls != mock_sleep.call_args_list @parametrize( @@ -537,7 +531,7 @@ ({"attempts": 2, "exceptions": (RuntimeError,)}, Exception, 0), ], ) -def test_retry_exceptions(mocked_sleep, case, raise_exc, delay_count): +def test_retry_exceptions(mock_sleep, case, raise_exc, delay_count): @_.retry(**case) def func(): raise raise_exc() @@ -545,10 +539,10 @@ with pytest.raises(raise_exc): func() - assert delay_count == mocked_sleep.call_count + assert delay_count == mock_sleep.call_count -def test_retry_on_exception(mocked_sleep): +def test_retry_on_exception(mock_sleep): attempts = 5 error_count = {True: 0} @@ -557,9 +551,9 @@ @_.retry(attempts=attempts, on_exception=on_exception) def func(): - raise Exception() + raise TypeError() - with pytest.raises(Exception): + with pytest.raises(TypeError): func() assert error_count[True] == attempts diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydash-5.1.0/tox.ini new/pydash-6.0.2/tox.ini --- old/pydash-5.1.0/tox.ini 2021-06-27 20:15:05.000000000 +0200 +++ new/pydash-6.0.2/tox.ini 2023-01-28 18:36:13.000000000 +0100 @@ -1,17 +1,19 @@ [tox] -envlist = py36, py37, py38, py39 +envlist = py37, py38, py39, py310, py311 +isolated_build = true [gh-actions] python = - 3.6: py36 3.7: py37 3.8: py38 3.9: py39 + 3.10: py310 + 3.11: py311 [testenv] passenv = * extras = dev commands = - {posargs:inv test} + {posargs:inv ci} setenv = TOX_ENV_SITE_PACKAGES_DIR = {envsitepackagesdir}