Hello community,
here is the log from the commit of package python-Cerberus for openSUSE:Factory checked in at 2019-05-13 14:47:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-Cerberus (Old)
and /work/SRC/openSUSE:Factory/.python-Cerberus.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Cerberus"
Mon May 13 14:47:45 2019 rev:5 rq:702121 version:1.3.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-Cerberus/python-Cerberus.changes 2019-05-02 19:17:19.305418454 +0200
+++ /work/SRC/openSUSE:Factory/.python-Cerberus.new.5148/python-Cerberus.changes 2019-05-13 14:47:51.554385305 +0200
@@ -1,0 +2,15 @@
+Sat May 11 09:20:30 UTC 2019 - Sebastian Wagner
+
+- Update to version 1.3.1:
+ Fixed
+ - Fixed the expansion of the deprecated rule names ``keyschema`` and
+ ``valueschema`` (`#482`_)
+ - ``*of_``-typesavers properly expand rule names containing ``_`` (`#484`_)
+ Improved
+ - Add ``maintainer`` and ``maintainer_email`` to setup.py (`#481`_)
+ - Add ``project_urls`` to setup.py (`#480`_)
+ - Don't ignore all exceptions during coercions for nullable fields. If a
+ - Coercion raises an exception for a nullable field where the field is not
+ ``None`` the validation now fails. (`#490`_)
+
+-------------------------------------------------------------------
Old:
----
Cerberus-1.3.tar.gz
New:
----
Cerberus-1.3.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-Cerberus.spec ++++++
--- /var/tmp/diff_new_pack.FaWMLh/_old 2019-05-13 14:47:53.158389297 +0200
+++ /var/tmp/diff_new_pack.FaWMLh/_new 2019-05-13 14:47:53.162389307 +0200
@@ -12,13 +12,13 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-Cerberus
-Version: 1.3
+Version: 1.3.1
Release: 0
Summary: Extensible schema and data validation tool for Python dictionaries
License: ISC
++++++ Cerberus-1.3.tar.gz -> Cerberus-1.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cerberus-1.3/AUTHORS new/Cerberus-1.3.1/AUTHORS
--- old/Cerberus-1.3/AUTHORS 2019-04-29 09:12:33.000000000 +0200
+++ new/Cerberus-1.3.1/AUTHORS 2019-05-07 09:02:34.000000000 +0200
@@ -42,6 +42,7 @@
- Martin Ortbauer
- Matthew Ellison
- Michael Klich
+- Nik Haldimann
- Nikita Melentev
- Nikita Vlaznev
- Paul Weaver
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cerberus-1.3/Cerberus.egg-info/PKG-INFO new/Cerberus-1.3.1/Cerberus.egg-info/PKG-INFO
--- old/Cerberus-1.3/Cerberus.egg-info/PKG-INFO 2019-04-30 11:16:56.000000000 +0200
+++ new/Cerberus-1.3.1/Cerberus.egg-info/PKG-INFO 2019-05-10 09:16:07.000000000 +0200
@@ -1,11 +1,16 @@
Metadata-Version: 1.2
Name: Cerberus
-Version: 1.3
+Version: 1.3.1
Summary: Lightweight, extensible schema and data validation tool for Python dictionaries.
Home-page: http://docs.python-cerberus.org
Author: Nicola Iarocci
Author-email: nicola@nicolaiarocci.com
+Maintainer: Frank Sachsenheim
+Maintainer-email: funkyfuture@riseup.net
License: ISC
+Project-URL: Documentation, http://python-cerberus.org
+Project-URL: Code, https://github.com/pyeve/cerberus
+Project-URL: Issue tracker, https://github.com/pyeve/cerberus/issues
Description: Cerberus |latest-version|
=========================
|build-status| |python-support| |black|
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cerberus-1.3/PKG-INFO new/Cerberus-1.3.1/PKG-INFO
--- old/Cerberus-1.3/PKG-INFO 2019-04-30 11:16:56.000000000 +0200
+++ new/Cerberus-1.3.1/PKG-INFO 2019-05-10 09:16:07.000000000 +0200
@@ -1,11 +1,16 @@
Metadata-Version: 1.2
Name: Cerberus
-Version: 1.3
+Version: 1.3.1
Summary: Lightweight, extensible schema and data validation tool for Python dictionaries.
Home-page: http://docs.python-cerberus.org
Author: Nicola Iarocci
Author-email: nicola@nicolaiarocci.com
+Maintainer: Frank Sachsenheim
+Maintainer-email: funkyfuture@riseup.net
License: ISC
+Project-URL: Documentation, http://python-cerberus.org
+Project-URL: Code, https://github.com/pyeve/cerberus
+Project-URL: Issue tracker, https://github.com/pyeve/cerberus/issues
Description: Cerberus |latest-version|
=========================
|build-status| |python-support| |black|
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cerberus-1.3/ROADMAP.md new/Cerberus-1.3.1/ROADMAP.md
--- old/Cerberus-1.3/ROADMAP.md 2019-04-29 09:12:33.000000000 +0200
+++ new/Cerberus-1.3.1/ROADMAP.md 2019-05-02 10:10:07.000000000 +0200
@@ -47,8 +47,8 @@
- [ ] A Python 3-style metaclass.
- [ ] Using `super()` to call overridden methods.
- [ ] Usage of dictionary comprehensions.
-- [ ] All functions and methods are type annotated. MyPy is added to the test
- suite.
+- [ ] All *public* functions and methods are type annotated. MyPy is added to
+ the test suite to validate these.
- [ ] A wider choice of type names that are closer oriented on the builtin
names are available. (#374)
- [ ] Objects from the `typing` module can be used as constraints for the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cerberus-1.3/cerberus/errors.py new/Cerberus-1.3.1/cerberus/errors.py
--- old/Cerberus-1.3/cerberus/errors.py 2019-04-29 09:12:33.000000000 +0200
+++ new/Cerberus-1.3.1/cerberus/errors.py 2019-05-02 10:10:07.000000000 +0200
@@ -3,12 +3,12 @@
from __future__ import absolute_import
-from collections import defaultdict, namedtuple, MutableMapping
+from collections import defaultdict, namedtuple
from copy import copy, deepcopy
from functools import wraps
from pprint import pformat
-from cerberus.platform import PYTHON_VERSION
+from cerberus.platform import PYTHON_VERSION, MutableMapping
from cerberus.utils import compare_paths_lt, quote_string
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cerberus-1.3/cerberus/schema.py new/Cerberus-1.3.1/cerberus/schema.py
--- old/Cerberus-1.3/cerberus/schema.py 2019-04-29 09:12:33.000000000 +0200
+++ new/Cerberus-1.3.1/cerberus/schema.py 2019-05-07 09:07:50.000000000 +0200
@@ -4,14 +4,20 @@
from warnings import warn
from cerberus import errors
-from cerberus.platform import _str_type
+from cerberus.platform import (
+ _str_type,
+ Callable,
+ Hashable,
+ Mapping,
+ MutableMapping,
+ Sequence,
+)
from cerberus.utils import (
get_Validator_class,
validator_factory,
mapping_hash,
TypeDefinition,
)
-from cerberus.platform import Callable, Hashable, Mapping, MutableMapping, Sequence
class _Abort(Exception):
@@ -138,7 +144,7 @@
for field in schema:
for of_rule in (x for x in schema[field] if is_of_rule(x)):
- operator, rule = of_rule.split('_')
+ operator, rule = of_rule.split('_', 1)
schema[field].update({operator: []})
for value in schema[field][of_rule]:
schema[field][operator].append({rule: value})
@@ -168,7 +174,8 @@
else: # assumes schema-constraints for a sequence
schema[field]['schema'] = cls.expand({0: schema[field]['schema']})[0]
- for rule in ('keysrules', 'valuesrules'):
+ # TODO remove the last two values in the tuple with the next major release
+ for rule in ('keysrules', 'valuesrules', 'keyschema', 'valueschema'):
if rule in schema[field]:
schema[field][rule] = cls.expand({0: schema[field][rule]})[0]
@@ -204,12 +211,17 @@
# TODO remove with next major release
@staticmethod
def _rename_deprecated_rulenames(schema):
- for old, new in (
- ('keyschema', 'keysrules'),
- ('validator', 'check_with'),
- ('valueschema', 'valuesrules'),
- ):
- for field, rules in schema.items():
+ for field, rules in schema.items():
+
+ if isinstance(rules, str): # registry reference
+ continue
+
+ for old, new in (
+ ('keyschema', 'keysrules'),
+ ('validator', 'check_with'),
+ ('valueschema', 'valuesrules'),
+ ):
+
if old not in rules:
continue
@@ -222,7 +234,7 @@
warn(
"The rule '{old}' was renamed to '{new}'. The old name will "
"not be available in the next major release of "
- "Cerberus".format(old=old, new=new),
+ "Cerberus.".format(old=old, new=new),
DeprecationWarning,
)
schema[field][new] = schema[field][old]
@@ -391,9 +403,8 @@
value = set((value,)) if isinstance(value, _str_type) else set(value)
invalid_constraints = value - set(self.target_validator.types)
if invalid_constraints:
- path = self.document_path + (field,)
self._error(
- path, 'Unsupported types: {}'.format(', '.join(invalid_constraints))
+ field, 'Unsupported types: {}'.format(', '.join(invalid_constraints))
)
def _expand_rules_set_refs(self, schema):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cerberus-1.3/cerberus/tests/__init__.py new/Cerberus-1.3.1/cerberus/tests/__init__.py
--- old/Cerberus-1.3/cerberus/tests/__init__.py 2018-07-18 13:24:14.000000000 +0200
+++ new/Cerberus-1.3.1/cerberus/tests/__init__.py 2019-05-07 09:07:50.000000000 +0200
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
+import re
+
import pytest
from cerberus import errors, Validator, SchemaError, DocumentError
@@ -12,10 +14,10 @@
if validator is None:
validator = Validator()
if msg is None:
- with pytest.raises(exception) as excinfo:
+ with pytest.raises(exception):
validator(document, schema)
else:
- with pytest.raises(exception, message=msg) as excinfo: # noqa: F841
+ with pytest.raises(exception, match=re.escape(msg)):
validator(document, schema)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cerberus-1.3/cerberus/tests/test_normalization.py new/Cerberus-1.3.1/cerberus/tests/test_normalization.py
--- old/Cerberus-1.3/cerberus/tests/test_normalization.py 2019-04-29 09:12:33.000000000 +0200
+++ new/Cerberus-1.3.1/cerberus/tests/test_normalization.py 2019-05-07 09:02:34.000000000 +0200
@@ -170,6 +170,18 @@
assert_normalized(document, document, schema)
+def test_nullables_fail_coerce_on_non_null_values(validator):
+ def failing_coercion(value):
+ raise Exception("expected to fail")
+
+ schema = {'foo': {'coerce': failing_coercion, 'nullable': True, 'type': 'integer'}}
+ document = {'foo': None}
+ assert_normalized(document, document, schema)
+
+ validator({'foo': 2}, schema)
+ assert errors.COERCION_FAILED in validator._errors
+
+
def test_normalized():
schema = {'amount': {'coerce': int}}
document = {'amount': '2'}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cerberus-1.3/cerberus/tests/test_schema.py new/Cerberus-1.3.1/cerberus/tests/test_schema.py
--- old/Cerberus-1.3/cerberus/tests/test_schema.py 2019-04-29 09:12:33.000000000 +0200
+++ new/Cerberus-1.3.1/cerberus/tests/test_schema.py 2019-05-07 09:07:50.000000000 +0200
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
+import re
+
import pytest
from cerberus import Validator, errors, SchemaError
@@ -9,14 +11,14 @@
def test_empty_schema():
validator = Validator()
- with pytest.raises(SchemaError, message=errors.SCHEMA_ERROR_MISSING):
+ with pytest.raises(SchemaError, match=errors.SCHEMA_ERROR_MISSING):
validator({}, schema=None)
def test_bad_schema_type(validator):
schema = "this string should really be dict"
- exp_msg = errors.SCHEMA_ERROR_DEFINITION_TYPE.format(schema)
- with pytest.raises(SchemaError, message=exp_msg):
+ msg = errors.SCHEMA_ERROR_DEFINITION_TYPE.format(schema)
+ with pytest.raises(SchemaError, match=msg):
validator.schema = schema
@@ -28,23 +30,21 @@
def test_unknown_rule(validator):
- message = "{'foo': [{'unknown': ['unknown rule']}]}"
- with pytest.raises(SchemaError, message=message):
+ msg = "{'foo': [{'unknown': ['unknown rule']}]}"
+ with pytest.raises(SchemaError, match=re.escape(msg)):
validator.schema = {'foo': {'unknown': 'rule'}}
def test_unknown_type(validator):
- field = 'name'
- value = 'catch_me'
- message = str({field: [{'type': ['unallowed value %s' % value]}]})
- with pytest.raises(SchemaError, message=message):
- validator.schema = {'foo': {'unknown': 'rule'}}
+ msg = str({'foo': [{'type': ['Unsupported types: unknown']}]})
+ with pytest.raises(SchemaError, match=re.escape(msg)):
+ validator.schema = {'foo': {'type': 'unknown'}}
def test_bad_schema_definition(validator):
field = 'name'
- message = str({field: ['must be of dict type']})
- with pytest.raises(SchemaError, message=message):
+ msg = str({field: ['must be of dict type']})
+ with pytest.raises(SchemaError, match=re.escape(msg)):
validator.schema = {field: 'this should really be a dict'}
@@ -111,3 +111,64 @@
schema = UnvalidatedSchema()
schema_copy = schema.copy()
assert schema_copy == schema
+
+
+# TODO remove with next major release
+def test_deprecated_rule_names_in_valueschema():
+ def check_with(field, value, error):
+ pass
+
+ schema = {
+ "field_1": {
+ "type": "dict",
+ "valueschema": {
+ "type": "dict",
+ "keyschema": {"type": "string"},
+ "valueschema": {"type": "string"},
+ },
+ },
+ "field_2": {
+ "type": "list",
+ "items": [
+ {"keyschema": {}},
+ {"validator": check_with},
+ {"valueschema": {}},
+ ],
+ },
+ }
+
+ validator = Validator(schema)
+
+ assert validator.schema == {
+ "field_1": {
+ "type": "dict",
+ "valuesrules": {
+ "type": "dict",
+ "keysrules": {"type": "string"},
+ "valuesrules": {"type": "string"},
+ },
+ },
+ "field_2": {
+ "type": "list",
+ "items": [
+ {"keysrules": {}},
+ {"check_with": check_with},
+ {"valuesrules": {}},
+ ],
+ },
+ }
+
+
+def test_anyof_check_with():
+ def foo(field, value, error):
+ pass
+
+ def bar(field, value, error):
+ pass
+
+ schema = {'field': {'anyof_check_with': [foo, bar]}}
+ validator = Validator(schema)
+
+ assert validator.schema == {
+ 'field': {'anyof': [{'check_with': foo}, {'check_with': bar}]}
+ }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cerberus-1.3/cerberus/validator.py new/Cerberus-1.3.1/cerberus/validator.py
--- old/Cerberus-1.3/cerberus/validator.py 2019-04-29 09:12:33.000000000 +0200
+++ new/Cerberus-1.3.1/cerberus/validator.py 2019-05-07 09:02:34.000000000 +0200
@@ -723,7 +723,7 @@
try:
return processor(value)
except Exception as e:
- if not nullable and e is not TypeError:
+ if not (nullable and value is None):
self._error(field, error, str(e))
return value
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cerberus-1.3/setup.py new/Cerberus-1.3.1/setup.py
--- old/Cerberus-1.3/setup.py 2019-04-30 11:16:25.000000000 +0200
+++ new/Cerberus-1.3.1/setup.py 2019-05-10 09:14:45.000000000 +0200
@@ -2,13 +2,14 @@
from setuptools import setup, find_packages
import sys
+from collections import OrderedDict
DESCRIPTION = (
"Lightweight, extensible schema and data validation tool for "
"Python dictionaries."
)
LONG_DESCRIPTION = open("README.rst").read()
-VERSION = "1.3"
+VERSION = "1.3.1"
setup_requires = (
["pytest-runner"] if any(x in sys.argv for x in ("pytest", "test", "ptr")) else []
@@ -22,7 +23,16 @@
long_description=LONG_DESCRIPTION,
author="Nicola Iarocci",
author_email="nicola@nicolaiarocci.com",
+ maintainer="Frank Sachsenheim",
+ maintainer_email="funkyfuture@riseup.net",
url="http://docs.python-cerberus.org",
+ project_urls=OrderedDict(
+ (
+ ("Documentation", "http://python-cerberus.org"),
+ ("Code", "https://github.com/pyeve/cerberus"),
+ ("Issue tracker", "https://github.com/pyeve/cerberus/issues"),
+ )
+ ),
license="ISC",
platforms=["any"],
packages=find_packages(),