Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-jmespath for openSUSE:Factory
checked in at 2023-01-24 19:42:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-jmespath (Old)
and /work/SRC/openSUSE:Factory/.python-jmespath.new.32243 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-jmespath"
Tue Jan 24 19:42:28 2023 rev:20 rq:1060481 version:1.0.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-jmespath/python-jmespath.changes
2021-09-30 23:43:10.060453737 +0200
+++
/work/SRC/openSUSE:Factory/.python-jmespath.new.32243/python-jmespath.changes
2023-01-24 20:31:58.148259753 +0100
@@ -1,0 +2,7 @@
+Sat Sep 17 15:41:47 UTC 2022 - Dirk Müller <[email protected]>
+
+- update to 1.0.1:
+ * Drop support for Python versions less than 3.7 (including Python 2).
+- drop remove-nose.patch (upstream)
+
+-------------------------------------------------------------------
Old:
----
jmespath-0.10.0.tar.gz
remove-nose.patch
New:
----
jmespath-1.0.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-jmespath.spec ++++++
--- /var/tmp/diff_new_pack.2WXffv/_old 2023-01-24 20:31:58.600262145 +0100
+++ /var/tmp/diff_new_pack.2WXffv/_new 2023-01-24 20:31:58.608262188 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-jmespath
#
-# Copyright (c) 2021 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
@@ -16,18 +16,18 @@
#
-%{?!python_module:%define python_module() python-%{**} python3-%{**}}
+%{?!python_module:%define python_module() python3-%{**}}
Name: python-jmespath
-Version: 0.10.0
+Version: 1.0.1
Release: 0
Summary: Python module for declarative JSON document element extraction
License: MIT
URL: https://github.com/jmespath/jmespath.py
Source:
https://github.com/jmespath/jmespath.py/archive/refs/tags/%{version}.tar.gz#/jmespath-%{version}.tar.gz
-Patch0: remove-nose.patch
# Testing
BuildRequires: %{python_module hypothesis}
BuildRequires: %{python_module ply >= 3.4}
+BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module simplejson}
BuildRequires: fdupes
@@ -71,8 +71,7 @@
The expression: foo.*.name will return ["one", "two"].
%prep
-%setup -q -n jmespath.py-%{version}
-%autopatch -p1
+%autosetup -p1 -n jmespath.py-%{version}
%build
%python_build
@@ -84,11 +83,8 @@
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
-%if 0%{?suse_version} > 1500
+# hangs on python 3.8 with pytest
%pyunittest discover -v
-%else
-%python_exec setup.py test
-%endif
%post
%python_install_alternative jp
++++++ jmespath-0.10.0.tar.gz -> jmespath-1.0.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/.github/workflows/run-tests.yml
new/jmespath.py-1.0.1/.github/workflows/run-tests.yml
--- old/jmespath.py-0.10.0/.github/workflows/run-tests.yml 2020-05-13
00:01:10.000000000 +0200
+++ new/jmespath.py-1.0.1/.github/workflows/run-tests.yml 2022-06-17
19:57:42.000000000 +0200
@@ -1,6 +1,6 @@
name: Run Tests
-on: [push]
+on: [push, pull_request]
jobs:
build:
@@ -9,12 +9,12 @@
strategy:
matrix:
os: [ubuntu-latest]
- python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
+ python-version: ["3.7", "3.8", "3.9", "3.10", "3.11-dev"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v1
+ uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
@@ -25,4 +25,4 @@
pip install dist/*.whl
- name: Test with pytest
run: |
- cd tests/ && nosetests --with-coverage --cover-package jmespath .
+ cd tests/ && py.test --cov jmespath --cov-report term-missing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/.travis.yml
new/jmespath.py-1.0.1/.travis.yml
--- old/jmespath.py-0.10.0/.travis.yml 2020-05-13 00:01:10.000000000 +0200
+++ new/jmespath.py-1.0.1/.travis.yml 1970-01-01 01:00:00.000000000 +0100
@@ -1,30 +0,0 @@
-dist: trusty
-language: python
-python:
- - "2.6"
- - "2.7"
- - "3.3"
- - "3.4"
- - "3.5"
- - "3.6"
- - "pypy"
-# Enable 3.7 without globally enabling dist: xenial for other build jobs
-matrix:
- include:
- - python: "3.7"
- dist: xenial
- - python: "3.8"
- dist: xenial
-before_install:
- - pip install codecov
-install:
- - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install unittest2; pip
install -r requirements26.txt; fi
- - "rm -rf dist/*"
- - pip install -r requirements.txt
- - python setup.py bdist_wheel
- - pip install dist/*.whl
-script:
- - cd tests/ && nosetests --with-coverage --cover-package jmespath .
- - if [[ $TRAVIS_PYTHON_VERSION != '2.6' ]] && [[ $TRAVIS_PYTHON_VERSION !=
'3.8' ]]; then JP_MAX_EXAMPLES=10000 nosetests ../extra/test_hypothesis.py; fi
-after_success:
- - codecov
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/CHANGELOG.rst
new/jmespath.py-1.0.1/CHANGELOG.rst
--- old/jmespath.py-0.10.0/CHANGELOG.rst 2020-05-13 00:01:10.000000000
+0200
+++ new/jmespath.py-1.0.1/CHANGELOG.rst 2022-06-17 19:57:42.000000000 +0200
@@ -1,3 +1,10 @@
+1.0.0
+=====
+
+* Drop support for Python versions less than 3.7 (including Python 2).
+ (`issue 268 <https://github.com/jmespath/jmespath.py/issues/268>`__)
+
+
0.10.0
======
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/README.rst
new/jmespath.py-1.0.1/README.rst
--- old/jmespath.py-0.10.0/README.rst 2020-05-13 00:01:10.000000000 +0200
+++ new/jmespath.py-1.0.1/README.rst 2022-06-17 19:57:42.000000000 +0200
@@ -6,14 +6,6 @@
:target: https://gitter.im/jmespath/chat
-.. image:: https://travis-ci.org/jmespath/jmespath.py.svg?branch=develop
- :target: https://travis-ci.org/jmespath/jmespath.py
-
-
-.. image::
https://codecov.io/github/jmespath/jmespath.py/coverage.svg?branch=develop
- :target: https://codecov.io/github/jmespath/jmespath.py?branch=develop
-
-
JMESPath (pronounced "james path") allows you to declaratively specify how to
extract elements from a JSON document.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/docs/conf.py
new/jmespath.py-1.0.1/docs/conf.py
--- old/jmespath.py-0.10.0/docs/conf.py 2020-05-13 00:01:10.000000000 +0200
+++ new/jmespath.py-1.0.1/docs/conf.py 2022-06-17 19:57:42.000000000 +0200
@@ -38,7 +38,7 @@
# The short X.Y version.
version = '0.8'
# The full version, including alpha/beta/rc tags.
-release = '0.10.0'
+release = '1.0.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/docs/proposals/exptype.rst
new/jmespath.py-1.0.1/docs/proposals/exptype.rst
--- old/jmespath.py-0.10.0/docs/proposals/exptype.rst 2020-05-13
00:01:10.000000000 +0200
+++ new/jmespath.py-1.0.1/docs/proposals/exptype.rst 2022-06-17
19:57:42.000000000 +0200
@@ -23,7 +23,9 @@
A useful feature that is common in other expression languages is the
ability to sort a JSON object based on a particular key. For example,
-given a JSON object::
+given a JSON object:
+
+.. code:: json
{
"people": [
@@ -46,7 +48,9 @@
be an ``identifier``, but more complex expressions could be used such as
``foo.bar.baz``.
-A simple way to accomplish this might be to create a function like this::
+A simple way to accomplish this might be to create a function like this:
+
+.. code:: python
sort_by(array arg1, expression)
@@ -56,7 +60,9 @@
sort_by(people, to_number(age_str))
However, there's a problem with the ``sort_by`` function as defined above.
-If we follow the function argument resolution process we get::
+If we follow the function argument resolution process we get:
+
+.. code:: python
sort_by(people, age)
@@ -107,7 +113,9 @@
``expression->type`` syntax.
Note that any valid expression is allowed after ``&``, so the following
-expressions are valid::
+expressions are valid:
+
+.. code:: python
sort_by(people, &foo.bar.baz)
sort_by(people, &foo.bar[0].baz)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/extra/test_hypothesis.py
new/jmespath.py-1.0.1/extra/test_hypothesis.py
--- old/jmespath.py-0.10.0/extra/test_hypothesis.py 2020-05-13
00:01:10.000000000 +0200
+++ new/jmespath.py-1.0.1/extra/test_hypothesis.py 2022-06-17
19:57:42.000000000 +0200
@@ -3,10 +3,8 @@
# can a) be run separately and b) allow for customization
# via env var for longer runs in travis.
import os
-import sys
import numbers
-from nose.plugins.skip import SkipTest
from hypothesis import given, settings, assume, HealthCheck
import hypothesis.strategies as st
@@ -16,11 +14,6 @@
from jmespath.functions import Functions
-if sys.version_info[:2] == (2, 6):
- raise RuntimeError("Hypothesis tests are not supported on python2.6. "
- "Use python2.7, or python3.3 and greater.")
-
-
JSON_NUMBERS = (st.integers() | st.floats(allow_nan=False,
allow_infinity=False))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/jmespath/__init__.py
new/jmespath.py-1.0.1/jmespath/__init__.py
--- old/jmespath.py-0.10.0/jmespath/__init__.py 2020-05-13 00:01:10.000000000
+0200
+++ new/jmespath.py-1.0.1/jmespath/__init__.py 2022-06-17 19:57:42.000000000
+0200
@@ -1,18 +1,7 @@
-import warnings
-import sys
from jmespath import parser
from jmespath.visitor import Options
-__version__ = '0.10.0'
-
-
-if sys.version_info[:2] <= (2, 6) or ((3, 0) <= sys.version_info[:2] <= (3,
3)):
- python_ver = '.'.join(str(x) for x in sys.version_info[:3])
-
- warnings.warn(
- 'You are using Python {0}, which will no longer be supported in '
- 'version 0.11.0'.format(python_ver),
- DeprecationWarning)
+__version__ = '1.0.1'
def compile(expression):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/jmespath/compat.py
new/jmespath.py-1.0.1/jmespath/compat.py
--- old/jmespath.py-0.10.0/jmespath/compat.py 2020-05-13 00:01:10.000000000
+0200
+++ new/jmespath.py-1.0.1/jmespath/compat.py 2022-06-17 19:57:42.000000000
+0200
@@ -1,65 +1,19 @@
import sys
import inspect
+from itertools import zip_longest
-PY2 = sys.version_info[0] == 2
+text_type = str
+string_type = str
-def with_metaclass(meta, *bases):
- # Taken from flask/six.
- class metaclass(meta):
- def __new__(cls, name, this_bases, d):
- return meta(name, bases, d)
- return type.__new__(metaclass, 'temporary_class', (), {})
-
-
-if PY2:
- text_type = unicode
- string_type = basestring
- from itertools import izip_longest as zip_longest
-
- def with_str_method(cls):
- """Class decorator that handles __str__ compat between py2 and py3."""
- # In python2, the __str__ should be __unicode__
- # and __str__ should return bytes.
- cls.__unicode__ = cls.__str__
- def __str__(self):
- return self.__unicode__().encode('utf-8')
- cls.__str__ = __str__
- return cls
-
- def with_repr_method(cls):
- """Class decorator that handle __repr__ with py2 and py3."""
- # This is almost the same thing as with_str_method *except*
- # it uses the unicode_escape encoding. This also means we need to be
- # careful encoding the input multiple times, so we only encode
- # if we get a unicode type.
- original_repr_method = cls.__repr__
- def __repr__(self):
- original_repr = original_repr_method(self)
- if isinstance(original_repr, text_type):
- original_repr = original_repr.encode('unicode_escape')
- return original_repr
- cls.__repr__ = __repr__
- return cls
-
- def get_methods(cls):
- for name, method in inspect.getmembers(cls,
- predicate=inspect.ismethod):
- yield name, method
-
-else:
- text_type = str
- string_type = str
- from itertools import zip_longest
-
- def with_str_method(cls):
- # In python3, we don't need to do anything, we return a str type.
- return cls
-
- def with_repr_method(cls):
- return cls
-
- def get_methods(cls):
- for name, method in inspect.getmembers(cls,
- predicate=inspect.isfunction):
- yield name, method
+
+def with_str_method(cls):
+ # In python3, we don't need to do anything, we return a str type.
+ return cls
+
+def with_repr_method(cls):
+ return cls
+
+def get_methods(cls):
+ for name, method in inspect.getmembers(cls, predicate=inspect.isfunction):
+ yield name, method
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/jmespath/functions.py
new/jmespath.py-1.0.1/jmespath/functions.py
--- old/jmespath.py-0.10.0/jmespath/functions.py 2020-05-13
00:01:10.000000000 +0200
+++ new/jmespath.py-1.0.1/jmespath/functions.py 2022-06-17 19:57:42.000000000
+0200
@@ -3,7 +3,7 @@
from jmespath import exceptions
from jmespath.compat import string_type as STRING_TYPE
-from jmespath.compat import get_methods, with_metaclass
+from jmespath.compat import get_methods
# python types -> jmespath types
@@ -64,7 +64,7 @@
cls.FUNCTION_TABLE = function_table
-class Functions(with_metaclass(FunctionRegistry, object)):
+class Functions(metaclass=FunctionRegistry):
FUNCTION_TABLE = {
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/jmespath/parser.py
new/jmespath.py-1.0.1/jmespath/parser.py
--- old/jmespath.py-0.10.0/jmespath/parser.py 2020-05-13 00:01:10.000000000
+0200
+++ new/jmespath.py-1.0.1/jmespath/parser.py 2022-06-17 19:57:42.000000000
+0200
@@ -489,7 +489,7 @@
lex_position, actual_value, actual_type, message)
def _free_cache_entries(self):
- for key in random.sample(self._CACHE.keys(), int(self._MAX_SIZE / 2)):
+ for key in random.sample(list(self._CACHE.keys()), int(self._MAX_SIZE
/ 2)):
self._CACHE.pop(key, None)
@classmethod
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/jmespath/visitor.py
new/jmespath.py-1.0.1/jmespath/visitor.py
--- old/jmespath.py-0.10.0/jmespath/visitor.py 2020-05-13 00:01:10.000000000
+0200
+++ new/jmespath.py-1.0.1/jmespath/visitor.py 2022-06-17 19:57:42.000000000
+0200
@@ -6,13 +6,13 @@
def _equals(x, y):
- if _is_special_integer_case(x, y):
+ if _is_special_number_case(x, y):
return False
else:
return x == y
-def _is_special_integer_case(x, y):
+def _is_special_number_case(x, y):
# We need to special case comparing 0 or 1 to
# True/False. While normally comparing any
# integer other than 0/1 to True/False will always
@@ -29,10 +29,10 @@
# Also need to consider that:
# >>> 0 in [True, False]
# True
- if type(x) is int and (x == 0 or x == 1):
- return y is True or y is False
- elif type(y) is int and (y == 0 or y == 1):
- return x is True or x is False
+ if _is_actual_number(x) and x in (0, 1):
+ return isinstance(y, bool)
+ elif _is_actual_number(y) and y in (0, 1):
+ return isinstance(x, bool)
def _is_comparable(x):
@@ -51,7 +51,7 @@
# True
# >>> isinstance(True, int)
# True
- if x is True or x is False:
+ if isinstance(x, bool):
return False
return isinstance(x, Number)
@@ -257,7 +257,7 @@
def visit_not_expression(self, node, value):
original_result = self.visit(node['children'][0], value)
- if type(original_result) is int and original_result == 0:
+ if _is_actual_number(original_result) and original_result == 0:
# Special case for 0, !0 should be false, not true.
# 0 is not a special cased integer in jmespath.
return False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/requirements.txt
new/jmespath.py-1.0.1/requirements.txt
--- old/jmespath.py-0.10.0/requirements.txt 2020-05-13 00:01:10.000000000
+0200
+++ new/jmespath.py-1.0.1/requirements.txt 2022-06-17 19:57:42.000000000
+0200
@@ -1,8 +1,6 @@
-nose==1.2.1
-py==1.4.12
-tox==1.4.2
wheel==0.24.0
-coverage==5.0.3 ; python_version == '3.8'
-coverage==3.7.1 ; python_version != '3.8'
-hypothesis==3.1.0 ; python_version != '3.8'
+pytest==6.2.5
+pytest-cov==3.0.0
+hypothesis==3.1.0 ; python_version < '3.8'
hypothesis==5.5.4 ; python_version == '3.8'
+hypothesis==5.35.4 ; python_version == '3.9'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/requirements26.txt
new/jmespath.py-1.0.1/requirements26.txt
--- old/jmespath.py-0.10.0/requirements26.txt 2020-05-13 00:01:10.000000000
+0200
+++ new/jmespath.py-1.0.1/requirements26.txt 1970-01-01 01:00:00.000000000
+0100
@@ -1,4 +0,0 @@
-# For the python2.6 tests, we need ordered dict.
-ordereddict==1.1
-unittest2==0.5.1
-simplejson==3.6.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/setup.cfg
new/jmespath.py-1.0.1/setup.cfg
--- old/jmespath.py-0.10.0/setup.cfg 2020-05-13 00:01:10.000000000 +0200
+++ new/jmespath.py-1.0.1/setup.cfg 2022-06-17 19:57:42.000000000 +0200
@@ -1,5 +1,5 @@
[bdist_wheel]
-universal = 1
+universal = 0
[metadata]
license_file = LICENSE.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/setup.py
new/jmespath.py-1.0.1/setup.py
--- old/jmespath.py-0.10.0/setup.py 2020-05-13 00:01:10.000000000 +0200
+++ new/jmespath.py-1.0.1/setup.py 2022-06-17 19:57:42.000000000 +0200
@@ -1,24 +1,13 @@
#!/usr/bin/env python
import io
-import sys
-import warnings
from setuptools import setup, find_packages
-if sys.version_info[:2] <= (2, 6) or ((3, 0) <= sys.version_info[:2] <= (3,
3)):
- python_ver = '.'.join(str(x) for x in sys.version_info[:3])
-
- warnings.warn(
- 'You are using Python {0}, which will no longer be supported in '
- 'version 0.11.0'.format(python_ver),
- DeprecationWarning)
-
-
setup(
name='jmespath',
- version='0.10.0',
+ version='1.0.1',
description='JSON Matching Expressions',
long_description=io.open('README.rst', encoding='utf-8').read(),
author='James Saryerwinnie',
@@ -27,22 +16,19 @@
scripts=['bin/jp.py'],
packages=find_packages(exclude=['tests']),
license='MIT',
- python_requires='>=2.6, !=3.0.*, !=3.1.*, !=3.2.*',
+ python_requires='>=3.7',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
- 'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.6',
- 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.3',
- 'Programming Language :: Python :: 3.4',
- 'Programming Language :: Python :: 3.5',
- 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3.9',
+ 'Programming Language :: Python :: 3.10',
+ 'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/tests/__init__.py
new/jmespath.py-1.0.1/tests/__init__.py
--- old/jmespath.py-0.10.0/tests/__init__.py 2020-05-13 00:01:10.000000000
+0200
+++ new/jmespath.py-1.0.1/tests/__init__.py 2022-06-17 19:57:42.000000000
+0200
@@ -1,18 +1,9 @@
import sys
from jmespath import ast
-
-# The unittest module got a significant overhaul
-# in 2.7, so if we're in 2.6 we can use the backported
-# version unittest2.
-if sys.version_info[:2] == (2, 6):
- import unittest2 as unittest
- import simplejson as json
- from ordereddict import OrderedDict
-else:
- import unittest
- import json
- from collections import OrderedDict
+import unittest
+import json
+from collections import OrderedDict
# Helper method used to create an s-expression
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/tests/compliance/boolean.json
new/jmespath.py-1.0.1/tests/compliance/boolean.json
--- old/jmespath.py-0.10.0/tests/compliance/boolean.json 2020-05-13
00:01:10.000000000 +0200
+++ new/jmespath.py-1.0.1/tests/compliance/boolean.json 2022-06-17
19:57:42.000000000 +0200
@@ -76,7 +76,8 @@
"False": false,
"Number": 5,
"EmptyList": [],
- "Zero": 0
+ "Zero": 0,
+ "ZeroFloat": 0.0
},
"cases": [
{
@@ -188,6 +189,10 @@
"result": true
},
{
+ "expression": "!True && False",
+ "result": false
+ },
+ {
"expression": "!(True && False)",
"result": true
},
@@ -198,6 +203,14 @@
{
"expression": "!!Zero",
"result": true
+ },
+ {
+ "expression": "Zero || Number",
+ "result": 0
+ },
+ {
+ "expression": "ZeroFloat || Number",
+ "result": 0.0
}
]
},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/tests/compliance/filters.json
new/jmespath.py-1.0.1/tests/compliance/filters.json
--- old/jmespath.py-0.10.0/tests/compliance/filters.json 2020-05-13
00:01:10.000000000 +0200
+++ new/jmespath.py-1.0.1/tests/compliance/filters.json 2022-06-17
19:57:42.000000000 +0200
@@ -81,6 +81,50 @@
]
},
{
+ "given": {"foo": [{"weight": 33.3},
+ {"weight": 44.4},
+ {"weight": 55.5}]},
+ "cases": [
+ {
+ "comment": "Greater than with a number",
+ "expression": "foo[?weight > `44.4`]",
+ "result": [{"weight": 55.5}]
+ },
+ {
+ "expression": "foo[?weight >= `44.4`]",
+ "result": [{"weight": 44.4}, {"weight": 55.5}]
+ },
+ {
+ "comment": "Greater than with a number",
+ "expression": "foo[?weight > `55.5`]",
+ "result": []
+ },
+ {
+ "comment": "Greater than with a number",
+ "expression": "foo[?weight < `44.4`]",
+ "result": [{"weight": 33.3}]
+ },
+ {
+ "comment": "Greater than with a number",
+ "expression": "foo[?weight <= `44.4`]",
+ "result": [{"weight": 33.3}, {"weight": 44.4}]
+ },
+ {
+ "comment": "Greater than with a number",
+ "expression": "foo[?weight < `33.3`]",
+ "result": []
+ },
+ {
+ "expression": "foo[?weight == `33.3`]",
+ "result": [{"weight": 33.3}]
+ },
+ {
+ "expression": "foo[?weight != `33.3`]",
+ "result": [{"weight": 44.4}, {"weight": 55.5}]
+ }
+ ]
+ },
+ {
"given": {"foo": [{"top": {"name": "a"}},
{"top": {"name": "b"}}]},
"cases": [
@@ -265,6 +309,88 @@
}
]
},
+ {
+ "given": {"foo": [
+ {"key": true},
+ {"key": false},
+ {"key": 0},
+ {"key": 0.0},
+ {"key": 1},
+ {"key": 1.0},
+ {"key": [0]},
+ {"key": null},
+ {"key": [1]},
+ {"key": []},
+ {"key": {}},
+ {"key": {"a":2}}
+ ]},
+ "cases": [
+ {
+ "expression": "foo[?key == `true`]",
+ "result": [{"key": true}]
+ },
+ {
+ "expression": "foo[?key == `false`]",
+ "result": [{"key": false}]
+ },
+ {
+ "expression": "foo[?key]",
+ "result": [
+ {"key": true},
+ {"key": 0},
+ {"key": 0.0},
+ {"key": 1},
+ {"key": 1.0},
+ {"key": [0]},
+ {"key": [1]},
+ {"key": {"a": 2}}
+ ]
+ },
+ {
+ "expression": "foo[? !key]",
+ "result": [
+ {"key": false},
+ {"key": null},
+ {"key": []},
+ {"key": {}}
+ ]
+ },
+ {
+ "expression": "foo[? !!key]",
+ "result": [
+ {"key": true},
+ {"key": 0},
+ {"key": 0.0},
+ {"key": 1},
+ {"key": 1.0},
+ {"key": [0]},
+ {"key": [1]},
+ {"key": {"a": 2}}
+ ]
+ },
+ {
+ "expression": "foo[? `true`]",
+ "result": [
+ {"key": true},
+ {"key": false},
+ {"key": 0},
+ {"key": 0.0},
+ {"key": 1},
+ {"key": 1.0},
+ {"key": [0]},
+ {"key": null},
+ {"key": [1]},
+ {"key": []},
+ {"key": {}},
+ {"key": {"a":2}}
+ ]
+ },
+ {
+ "expression": "foo[? `false`]",
+ "result": []
+ }
+ ]
+ },
{
"given": {"reservations": [
{"instances": [
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/tests/compliance/functions.json
new/jmespath.py-1.0.1/tests/compliance/functions.json
--- old/jmespath.py-0.10.0/tests/compliance/functions.json 2020-05-13
00:01:10.000000000 +0200
+++ new/jmespath.py-1.0.1/tests/compliance/functions.json 2022-06-17
19:57:42.000000000 +0200
@@ -580,12 +580,12 @@
"error": "invalid-arity"
},
{
- "description": "function projection on single arg function",
+ "comment": "function projection on single arg function",
"expression": "numbers[].to_string(@)",
"result": ["-1", "3", "4", "5"]
},
{
- "description": "function projection on single arg function",
+ "comment": "function projection on single arg function",
"expression": "array[].to_number(@)",
"result": [-1, 3, 4, 5, 100]
}
@@ -603,7 +603,7 @@
},
"cases": [
{
- "description": "function projection on variadic function",
+ "comment": "function projection on variadic function",
"expression": "foo[].not_null(f, e, d, c, b, a)",
"result": ["b", "c", "d", "e", "f"]
}
@@ -621,7 +621,7 @@
},
"cases": [
{
- "description": "sort by field expression",
+ "comment": "sort by field expression",
"expression": "sort_by(people, &age)",
"result": [
{"age": 10, "age_str": "10", "bool": true, "name": 3},
@@ -642,7 +642,7 @@
]
},
{
- "description": "sort by function expression",
+ "comment": "sort by function expression",
"expression": "sort_by(people, &to_number(age_str))",
"result": [
{"age": 10, "age_str": "10", "bool": true, "name": 3},
@@ -653,7 +653,7 @@
]
},
{
- "description": "function projection on sort_by function",
+ "comment": "function projection on sort_by function",
"expression": "sort_by(people, &age)[].name",
"result": [3, "a", "c", "b", "d"]
},
@@ -749,7 +749,7 @@
},
"cases": [
{
- "description": "stable sort order",
+ "comment": "stable sort order",
"expression": "sort_by(people, &age)",
"result": [
{"age": 10, "order": "1"},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/tests/compliance/literal.json
new/jmespath.py-1.0.1/tests/compliance/literal.json
--- old/jmespath.py-0.10.0/tests/compliance/literal.json 2020-05-13
00:01:10.000000000 +0200
+++ new/jmespath.py-1.0.1/tests/compliance/literal.json 2022-06-17
19:57:42.000000000 +0200
@@ -184,6 +184,16 @@
"comment": "Can escape the single quote",
"expression": "'foo\\'bar'",
"result": "foo'bar"
+ },
+ {
+ "comment": "Backslash not followed by single quote is treated as any
other character",
+ "expression": "'\\z'",
+ "result": "\\z"
+ },
+ {
+ "comment": "Backslash not followed by single quote is treated as any
other character",
+ "expression": "'\\\\'",
+ "result": "\\\\"
}
]
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/tests/compliance/syntax.json
new/jmespath.py-1.0.1/tests/compliance/syntax.json
--- old/jmespath.py-0.10.0/tests/compliance/syntax.json 2020-05-13
00:01:10.000000000 +0200
+++ new/jmespath.py-1.0.1/tests/compliance/syntax.json 2022-06-17
19:57:42.000000000 +0200
@@ -7,6 +7,10 @@
"result": null
},
{
+ "expression": "foo",
+ "result": null
+ },
+ {
"expression": "foo.1",
"error": "syntax"
},
@@ -417,6 +421,16 @@
"error": "syntax"
},
{
+ "comment": "Missing value",
+ "expression": "a.{foo:}",
+ "error": "syntax"
+ },
+ {
+ "comment": "Missing value with trailing comma",
+ "expression": "a.{foo: ,}",
+ "error": "syntax"
+ },
+ {
"comment": "Valid multi-select hash extraction",
"expression": "a.{foo: bar}",
"result": null
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/tests/test_compliance.py
new/jmespath.py-1.0.1/tests/test_compliance.py
--- old/jmespath.py-0.10.0/tests/test_compliance.py 2020-05-13
00:01:10.000000000 +0200
+++ new/jmespath.py-1.0.1/tests/test_compliance.py 2022-06-17
19:57:42.000000000 +0200
@@ -3,7 +3,7 @@
from tests import OrderedDict
from tests import json
-from nose.tools import assert_equal
+import pytest
from jmespath.visitor import Options
@@ -15,7 +15,7 @@
OPTIONS = Options(dict_cls=OrderedDict)
-def test_compliance():
+def _compliance_tests(requested_test_type):
for full_path in _walk_files():
if full_path.endswith('.json'):
for given, test_type, test_data in load_cases(full_path):
@@ -23,11 +23,11 @@
# Benchmark tests aren't run as part of the normal
# test suite, so we only care about 'result' and
# 'error' test_types.
- if test_type == 'result':
- yield (_test_expression, given, t['expression'],
+ if test_type == 'result' and test_type == requested_test_type:
+ yield (given, t['expression'],
t['result'], os.path.basename(full_path))
- elif test_type == 'error':
- yield (_test_error_expression, given, t['expression'],
+ elif test_type == 'error' and test_type == requested_test_type:
+ yield (given, t['expression'],
t['error'], os.path.basename(full_path))
@@ -63,7 +63,11 @@
yield (given, test_type, case)
-def _test_expression(given, expression, expected, filename):
[email protected](
+ 'given, expression, expected, filename',
+ _compliance_tests('result')
+)
+def test_expression(given, expression, expected, filename):
import jmespath.parser
try:
parsed = jmespath.compile(expression)
@@ -80,10 +84,14 @@
actual_repr, pformat(parsed.parsed),
json.dumps(given, indent=4)))
error_msg = error_msg.replace(r'\n', '\n')
- assert_equal(actual, expected, error_msg)
+ assert actual == expected, error_msg
-def _test_error_expression(given, expression, error, filename):
[email protected](
+ 'given, expression, error, filename',
+ _compliance_tests('error')
+)
+def test_error_expression(given, expression, error, filename):
import jmespath.parser
if error not in ('syntax', 'invalid-type',
'unknown-function', 'invalid-arity', 'invalid-value'):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/tests/test_lexer.py
new/jmespath.py-1.0.1/tests/test_lexer.py
--- old/jmespath.py-0.10.0/tests/test_lexer.py 2020-05-13 00:01:10.000000000
+0200
+++ new/jmespath.py-1.0.1/tests/test_lexer.py 2022-06-17 19:57:42.000000000
+0200
@@ -152,7 +152,7 @@
tokens = list(self.lexer.tokenize('^foo[0]'))
def test_unknown_character_with_identifier(self):
- with self.assertRaisesRegexp(LexerError, "Unknown token"):
+ with self.assertRaisesRegex(LexerError, "Unknown token"):
list(self.lexer.tokenize('foo-bar'))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jmespath.py-0.10.0/tests/test_parser.py
new/jmespath.py-1.0.1/tests/test_parser.py
--- old/jmespath.py-0.10.0/tests/test_parser.py 2020-05-13 00:01:10.000000000
+0200
+++ new/jmespath.py-1.0.1/tests/test_parser.py 2022-06-17 19:57:42.000000000
+0200
@@ -169,7 +169,7 @@
error_message = re.compile(
r'Bad jmespath expression: '
r'Invalid \\uXXXX escape.*\\uAZ12', re.DOTALL)
- with self.assertRaisesRegexp(exceptions.LexerError, error_message):
+ with self.assertRaisesRegex(exceptions.LexerError, error_message):
self.parser.parse(r'"\uAZ12"')