Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-xmlschema for openSUSE:Factory checked in at 2023-05-24 20:21:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-xmlschema (Old) and /work/SRC/openSUSE:Factory/.python-xmlschema.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-xmlschema" Wed May 24 20:21:40 2023 rev:23 rq:1088468 version:2.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-xmlschema/python-xmlschema.changes 2023-04-22 21:58:50.064633165 +0200 +++ /work/SRC/openSUSE:Factory/.python-xmlschema.new.1533/python-xmlschema.changes 2023-05-24 20:21:48.907983745 +0200 @@ -1,0 +2,7 @@ +Mon May 22 21:24:38 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 2.3.0: + * Improve sequence/all restriction checks for XSD 1.1 + * Add *schema* argument to `Wsdl11Document` + +------------------------------------------------------------------- Old: ---- xmlschema-2.2.3.tar.gz New: ---- xmlschema-2.3.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-xmlschema.spec ++++++ --- /var/tmp/diff_new_pack.Pw5PnK/_old 2023-05-24 20:21:49.507987323 +0200 +++ /var/tmp/diff_new_pack.Pw5PnK/_new 2023-05-24 20:21:49.515987371 +0200 @@ -16,11 +16,9 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} -%define skip_python2 1 %{?sle15_python_module_pythons} Name: python-xmlschema -Version: 2.2.3 +Version: 2.3.0 Release: 0 Summary: An XML Schema validator and decoder License: MIT ++++++ xmlschema-2.2.3.tar.gz -> xmlschema-2.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/CHANGELOG.rst new/xmlschema-2.3.0/CHANGELOG.rst --- old/xmlschema-2.2.3/CHANGELOG.rst 2023-04-14 15:49:05.000000000 +0200 +++ new/xmlschema-2.3.0/CHANGELOG.rst 2023-05-18 22:18:16.000000000 +0200 @@ -2,6 +2,11 @@ CHANGELOG ********* +`v2.3.0`_ (2023-05-18) +====================== +* Improve sequence/all restriction checks for XSD 1.1 +* Add *schema* argument to `Wsdl11Document` + `v2.2.3`_ (2023-04-14) ====================== * Add support for Python 3.12 @@ -616,3 +621,4 @@ .. _v2.2.1: https://github.com/brunato/xmlschema/compare/v2.2.0...v2.2.1 .. _v2.2.2: https://github.com/brunato/xmlschema/compare/v2.2.1...v2.2.2 .. _v2.2.3: https://github.com/brunato/xmlschema/compare/v2.2.2...v2.2.3 +.. _v2.3.0: https://github.com/brunato/xmlschema/compare/v2.2.3...v2.3.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/PKG-INFO new/xmlschema-2.3.0/PKG-INFO --- old/xmlschema-2.2.3/PKG-INFO 2023-04-14 15:52:42.466140500 +0200 +++ new/xmlschema-2.3.0/PKG-INFO 2023-05-18 22:19:54.688786300 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: xmlschema -Version: 2.2.3 +Version: 2.3.0 Summary: An XML Schema validator and decoder Home-page: https://github.com/sissaschool/xmlschema Author: Davide Brunato diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/doc/conf.py new/xmlschema-2.3.0/doc/conf.py --- old/xmlschema-2.2.3/doc/conf.py 2023-04-14 15:49:05.000000000 +0200 +++ new/xmlschema-2.3.0/doc/conf.py 2023-05-18 22:18:16.000000000 +0200 @@ -79,9 +79,9 @@ # built documents. # # The short X.Y version. -version = '2.2' +version = '2.3' # The full version, including alpha/beta/rc tags. -release = '2.2.3' +release = '2.3.0' # 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/xmlschema-2.2.3/requirements-dev.txt new/xmlschema-2.3.0/requirements-dev.txt --- old/xmlschema-2.2.3/requirements-dev.txt 2023-02-06 07:20:42.000000000 +0100 +++ new/xmlschema-2.3.0/requirements-dev.txt 2023-05-18 22:18:16.000000000 +0200 @@ -2,7 +2,7 @@ setuptools tox>=4.0 coverage -elementpath>=4.0.0, <5.0.0 +elementpath>=4.1.2, <5.0.0 lxml jinja2 memory_profiler diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/setup.py new/xmlschema-2.3.0/setup.py --- old/xmlschema-2.2.3/setup.py 2023-04-14 15:49:05.000000000 +0200 +++ new/xmlschema-2.3.0/setup.py 2023-05-18 22:18:16.000000000 +0200 @@ -18,7 +18,7 @@ setup( name='xmlschema', - version='2.2.3', + version='2.3.0', packages=find_packages(include=['xmlschema*']), package_data={ 'xmlschema': ['py.typed', 'locale/**/*.mo', 'locale/**/*.po', 'schemas/*/*.xsd'], @@ -32,13 +32,13 @@ ] }, python_requires='>=3.7', - install_requires=['elementpath>=4.0.0, <5.0.0'], + install_requires=['elementpath>=4.1.2, <5.0.0'], extras_require={ - 'codegen': ['elementpath>=4.0.0, <5.0.0', 'jinja2'], - 'dev': ['tox', 'coverage', 'lxml', 'elementpath>=4.0.0, <5.0.0', + 'codegen': ['elementpath>=4.1.2, <5.0.0', 'jinja2'], + 'dev': ['tox', 'coverage', 'lxml', 'elementpath>=4.1.2, <5.0.0', 'memory_profiler', 'Sphinx', 'sphinx_rtd_theme', 'jinja2', 'flake8', 'mypy', 'lxml-stubs'], - 'docs': ['elementpath>=4.0.0, <5.0.0', 'Sphinx', 'sphinx_rtd_theme', 'jinja2'] + 'docs': ['elementpath>=4.1.2, <5.0.0', 'Sphinx', 'sphinx_rtd_theme', 'jinja2'] }, author='Davide Brunato', author_email='brun...@sissa.it', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/tests/test_cases/features/derivations/complex11-restrictions.xsd new/xmlschema-2.3.0/tests/test_cases/features/derivations/complex11-restrictions.xsd --- old/xmlschema-2.2.3/tests/test_cases/features/derivations/complex11-restrictions.xsd 1970-01-01 01:00:00.000000000 +0100 +++ new/xmlschema-2.3.0/tests/test_cases/features/derivations/complex11-restrictions.xsd 2023-05-18 22:18:16.000000000 +0200 @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Schema test for invalid models: occurrence violation. --> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xs:complexType name="baseType1"> + <xs:sequence> + <xs:element name="elem1" minOccurs="0"/> + <xs:sequence minOccurs="0" maxOccurs="unbounded"> + <xs:element name="elem2" type="xs:string" /> + <xs:element name="elem3" type="xs:string" /> + </xs:sequence> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="restrictedType1"> + <xs:complexContent> + <xs:restriction base="baseType1"> + <xs:sequence minOccurs="0" maxOccurs="unbounded"> + <xs:element name="elem2" type="xs:string" /> + <xs:element name="elem3" type="xs:string" /> + </xs:sequence> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="baseType2"> + <xs:sequence> + <xs:element name="elem1" minOccurs="0"/> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element name="elem2" type="xs:string" /> + <xs:element name="elem3" type="xs:string" /> + </xs:choice> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="restrictedType2"> + <xs:complexContent> + <xs:restriction base="baseType2"> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element name="elem2" type="xs:string" /> + <xs:element name="elem3" type="xs:string" /> + </xs:choice> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="baseType3"> + <xs:sequence> + <xs:element name="elem1" minOccurs="0"/> + <xs:choice maxOccurs="5"> + <xs:element name="elem2" type="xs:string" maxOccurs="2"/> + <xs:element name="elem3" type="xs:string" maxOccurs="2"/> + </xs:choice> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="restrictedType3"> + <xs:complexContent> + <xs:restriction base="baseType3"> + <xs:choice maxOccurs="10"> + <xs:element name="elem3" type="xs:string" /> + </xs:choice> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="baseType4"> + <xs:sequence> + <xs:element name="elem1" minOccurs="0"/> + <xs:choice maxOccurs="5"> + <xs:element name="elem2" type="xs:string" maxOccurs="3"/> + <xs:element name="elem3" type="xs:string" maxOccurs="4"/> + </xs:choice> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="restrictedType4"> + <xs:complexContent> + <xs:restriction base="baseType4"> + <xs:choice maxOccurs="10"> + <xs:element name="elem3" type="xs:string" maxOccurs="2"/> + </xs:choice> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="baseType5"> + <xs:sequence> + <xs:element name="elem1" minOccurs="0"/> + <xs:choice minOccurs="5" maxOccurs="unbounded"> + <xs:element name="elem2" type="xs:string" maxOccurs="3"/> + <xs:element name="elem3" type="xs:string" maxOccurs="4"/> + </xs:choice> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="restrictedType5"> + <xs:complexContent> + <xs:restriction base="baseType5"> + <xs:choice minOccurs="10" maxOccurs="unbounded"> + <xs:element name="elem3" type="xs:string" maxOccurs="2"/> + </xs:choice> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + +</xs:schema> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/tests/test_cases/features/derivations/invalid-enumeration-restriction.xsd new/xmlschema-2.3.0/tests/test_cases/features/derivations/invalid-enumeration-restriction.xsd --- old/xmlschema-2.2.3/tests/test_cases/features/derivations/invalid-enumeration-restriction.xsd 1970-01-01 01:00:00.000000000 +0100 +++ new/xmlschema-2.3.0/tests/test_cases/features/derivations/invalid-enumeration-restriction.xsd 2023-05-18 22:18:16.000000000 +0200 @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <!-- Invalid enumeration restriction related to issue #202 --> + <xs:simpleType name="LocalEnergyProductType"> + <xs:restriction base="xs:NMTOKEN"> + <xs:enumeration value="8716867000016" /> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="LocalRestrictedEnergyProductType"> + <xs:restriction base="LocalEnergyProductType"> + <xs:enumeration value="A01"/> <!-- not a valid value for base type --> + </xs:restriction> + </xs:simpleType> + +</xs:schema> + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/tests/test_cases/features/derivations/invalid-restrictions1.xsd new/xmlschema-2.3.0/tests/test_cases/features/derivations/invalid-restrictions1.xsd --- old/xmlschema-2.2.3/tests/test_cases/features/derivations/invalid-restrictions1.xsd 1970-01-01 01:00:00.000000000 +0100 +++ new/xmlschema-2.3.0/tests/test_cases/features/derivations/invalid-restrictions1.xsd 2023-05-18 22:18:16.000000000 +0200 @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Schema test for invalid restricted models: UPA violation restricting a substitution group head. --> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xs:element type="xs:string" name="elem1"/> + <xs:element type="xs:string" name="elem2" substitutionGroup="elem1" /> + + <xs:complexType name="basicType1"> + <xs:sequence> + <xs:element ref="elem1" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + + <!-- UPA violation minOccurs < maxOccurs --> + <xs:complexType name="restrictedType1"> + <xs:complexContent> + <xs:restriction base="basicType1"> + <xs:sequence> + <xs:element ref="elem2" maxOccurs="unbounded"/> + </xs:sequence> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <!-- No UPA violation if the restricted element is empty but elem2 is not a restriction --> + <xs:complexType name="restrictedType2"> + <xs:complexContent> + <xs:restriction base="basicType1"> + <xs:sequence> + <xs:element ref="elem2" minOccurs="0" maxOccurs="0"/> + </xs:sequence> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + + <xs:element type="xs:string" name="elem3" abstract="true"/> + <xs:element type="xs:string" name="elem4" substitutionGroup="elem3" /> + + <xs:complexType name="basicType3"> + <xs:sequence> + <xs:element ref="elem3" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + + <!-- No UPA violation if the head element is abstract (it cannot be used in an instance). --> + <xs:complexType name="restrictedType3"> + <xs:complexContent> + <xs:restriction base="basicType3"> + <xs:sequence> + <xs:element ref="elem4" maxOccurs="unbounded"/> + </xs:sequence> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + +</xs:schema> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/tests/test_cases/features/derivations/invalid-restrictions2.xsd new/xmlschema-2.3.0/tests/test_cases/features/derivations/invalid-restrictions2.xsd --- old/xmlschema-2.2.3/tests/test_cases/features/derivations/invalid-restrictions2.xsd 1970-01-01 01:00:00.000000000 +0100 +++ new/xmlschema-2.3.0/tests/test_cases/features/derivations/invalid-restrictions2.xsd 2023-05-18 22:18:16.000000000 +0200 @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Schema test for invalid model restriction (issue 344): +occurrence violation for XSD 1.0, not emptiable particle for XSD 1.1. --> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xs:complexType name="baseType1"> + <xs:sequence> + <xs:element name="elem1" /> + <xs:sequence minOccurs="0" maxOccurs="unbounded"> + <xs:element name="elem2" type="xs:string" /> + <xs:element name="elem3" type="xs:string" /> + </xs:sequence> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="restrictedType1"> + <xs:complexContent> + <xs:restriction base="baseType1"> + <xs:sequence minOccurs="0" maxOccurs="unbounded"> + <xs:element name="elem2" type="xs:string" /> + <xs:element name="elem3" type="xs:string" /> + </xs:sequence> + </xs:restriction> + </xs:complexContent> + </xs:complexType> + +</xs:schema> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/tests/test_cases/features/derivations/invalid_enumeration_restriction.xsd new/xmlschema-2.3.0/tests/test_cases/features/derivations/invalid_enumeration_restriction.xsd --- old/xmlschema-2.2.3/tests/test_cases/features/derivations/invalid_enumeration_restriction.xsd 2020-09-13 21:12:09.000000000 +0200 +++ new/xmlschema-2.3.0/tests/test_cases/features/derivations/invalid_enumeration_restriction.xsd 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <!-- Invalid enumeration restriction related to issue #202 --> - <xs:simpleType name="LocalEnergyProductType"> - <xs:restriction base="xs:NMTOKEN"> - <xs:enumeration value="8716867000016" /> - </xs:restriction> - </xs:simpleType> - - <xs:simpleType name="LocalRestrictedEnergyProductType"> - <xs:restriction base="LocalEnergyProductType"> - <xs:enumeration value="A01"/> <!-- not a valid value for base type --> - </xs:restriction> - </xs:simpleType> - -</xs:schema> - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/tests/test_cases/features/derivations/invalid_restrictions1.xsd new/xmlschema-2.3.0/tests/test_cases/features/derivations/invalid_restrictions1.xsd --- old/xmlschema-2.2.3/tests/test_cases/features/derivations/invalid_restrictions1.xsd 2020-08-14 21:07:25.000000000 +0200 +++ new/xmlschema-2.3.0/tests/test_cases/features/derivations/invalid_restrictions1.xsd 1970-01-01 01:00:00.000000000 +0100 @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Schema test for invalid restricted models: UPA violation restricting a substitution group head. --> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - - <xs:element type="xs:string" name="elem1"/> - <xs:element type="xs:string" name="elem2" substitutionGroup="elem1" /> - - <xs:complexType name="basicType1"> - <xs:sequence> - <xs:element ref="elem1" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - - <!-- UPA violation minOccurs < maxOccurs --> - <xs:complexType name="restrictedType1"> - <xs:complexContent> - <xs:restriction base="basicType1"> - <xs:sequence> - <xs:element ref="elem2" maxOccurs="unbounded"/> - </xs:sequence> - </xs:restriction> - </xs:complexContent> - </xs:complexType> - - <!-- No UPA violation if the restricted element is empty but elem2 is not a restriction --> - <xs:complexType name="restrictedType2"> - <xs:complexContent> - <xs:restriction base="basicType1"> - <xs:sequence> - <xs:element ref="elem2" minOccurs="0" maxOccurs="0"/> - </xs:sequence> - </xs:restriction> - </xs:complexContent> - </xs:complexType> - - <xs:element type="xs:string" name="elem3" abstract="true"/> - <xs:element type="xs:string" name="elem4" substitutionGroup="elem3" /> - - <xs:complexType name="basicType3"> - <xs:sequence> - <xs:element ref="elem3" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - - <!-- No UPA violation if the head element is abstract (it cannot be used in an instance). --> - <xs:complexType name="restrictedType3"> - <xs:complexContent> - <xs:restriction base="basicType3"> - <xs:sequence> - <xs:element ref="elem4" maxOccurs="unbounded"/> - </xs:sequence> - </xs:restriction> - </xs:complexContent> - </xs:complexType> - -</xs:schema> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/tests/test_cases/features/derivations/invalid_restrictions2.xsd new/xmlschema-2.3.0/tests/test_cases/features/derivations/invalid_restrictions2.xsd --- old/xmlschema-2.2.3/tests/test_cases/features/derivations/invalid_restrictions2.xsd 2020-01-23 21:05:17.000000000 +0100 +++ new/xmlschema-2.3.0/tests/test_cases/features/derivations/invalid_restrictions2.xsd 1970-01-01 01:00:00.000000000 +0100 @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Schema test for invalid models: UPA violation restricting a substitution group head. --> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - - <xs:complexType name="baseType1"> - <xs:sequence> - <xs:element name="elem1" /> - <xs:element minOccurs="0" name="elem2" /> - <xs:choice> - <xs:element name="elem3" type="xs:string" /> - <xs:element name="elem4" type="xs:string" /> - </xs:choice> - <xs:element minOccurs="0" name="elem5" /> - <xs:element minOccurs="0" name="elem6" type="xs:string" /> - <xs:element minOccurs="0" name="elem7" /> - </xs:sequence> - </xs:complexType> - - <xs:complexType name="restrictedType1"> - <xs:complexContent> - <xs:restriction base="baseType1"> - <xs:sequence> - <xs:sequence> - <xs:element name="elem1" /> - <xs:element minOccurs="0" name="elem2" /> - <xs:choice> - <xs:element name="elem3" type="xs:token" /> - <xs:element name="elem4" type="xs:string" /> - </xs:choice> - <xs:sequence> - <xs:element minOccurs="0" name="elem6" type="xs:string" /> - </xs:sequence> - </xs:sequence> - <xs:sequence> - <xs:element minOccurs="0" name="elem7" /> - </xs:sequence> - </xs:sequence> - </xs:restriction> - </xs:complexContent> - </xs:complexType> - -</xs:schema> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/tests/test_cases/features/wsdl/wsdl11_example3.wsdl new/xmlschema-2.3.0/tests/test_cases/features/wsdl/wsdl11_example3.wsdl --- old/xmlschema-2.2.3/tests/test_cases/features/wsdl/wsdl11_example3.wsdl 2020-11-08 23:15:33.000000000 +0100 +++ new/xmlschema-2.3.0/tests/test_cases/features/wsdl/wsdl11_example3.wsdl 2023-05-18 22:18:16.000000000 +0200 @@ -3,7 +3,7 @@ Original example #3 from WSDL 1.1 definition with SOAP 1.1 bindings: href: https://www.w3.org/TR/2001/NOTE-wsdl-20010315#_soap-e -Thi version contains a typo in <binding> definition +This case contains a typo in <binding> definition --> <definitions name="StockQuote" targetNamespace="http://example.com/stockquote.wsdl" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/tests/test_cases/features/wsdl/wsdl11_example3_no_types.wsdl new/xmlschema-2.3.0/tests/test_cases/features/wsdl/wsdl11_example3_no_types.wsdl --- old/xmlschema-2.2.3/tests/test_cases/features/wsdl/wsdl11_example3_no_types.wsdl 1970-01-01 01:00:00.000000000 +0100 +++ new/xmlschema-2.3.0/tests/test_cases/features/wsdl/wsdl11_example3_no_types.wsdl 2023-05-18 22:18:16.000000000 +0200 @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<!-- +Example #3 from WSDL 1.1 definition with SOAP 1.1 bindings: + href: https://www.w3.org/TR/2001/NOTE-wsdl-20010315#_soap-e +--> +<definitions name="StockQuote" + targetNamespace="http://example.com/stockquote.wsdl" + xmlns:tns="http://example.com/stockquote.wsdl" + xmlns:xsd1="http://example.com/stockquote.xsd" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns="http://schemas.xmlsoap.org/wsdl/"> + + <message name="SubscribeToQuotes"> + <part name="body" element="xsd1:SubscribeToQuotes"/> + <part name="subscribeheader" element="xsd1:SubscriptionHeader"/> + </message> + + <portType name="StockQuotePortType"> + <operation name="SubscribeToQuotes"> + <input message="tns:SubscribeToQuotes"/> + </operation> + </portType> + + <binding name="StockQuoteSoap" type="tns:StockQuotePortType"> + <soap:binding style="document" transport="http://example.com/smtp"/> + <operation name="SubscribeToQuotes"> + <input> + <soap:body parts="body" use="literal"/> + <soap:header message="tns:SubscribeToQuotes" part="subscribeheader" use="literal"/> + </input> + </operation> + </binding> + + <service name="StockQuoteService"> + <port name="StockQuotePort" binding="tns:StockQuoteSoap"> + <soap:address location="mailto:subscr...@example.com"/> + </port> + </service> +</definitions> \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/tests/test_cases/features/wsdl/wsdl11_example3_types.xsd new/xmlschema-2.3.0/tests/test_cases/features/wsdl/wsdl11_example3_types.xsd --- old/xmlschema-2.2.3/tests/test_cases/features/wsdl/wsdl11_example3_types.xsd 1970-01-01 01:00:00.000000000 +0100 +++ new/xmlschema-2.3.0/tests/test_cases/features/wsdl/wsdl11_example3_types.xsd 2023-05-18 22:18:16.000000000 +0200 @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<schema targetNamespace="http://example.com/stockquote.xsd" + xmlns="http://www.w3.org/2001/XMLSchema"> + <element name="SubscribeToQuotes"> + <complexType> + <all> + <element name="tickerSymbol" type="string"/> + </all> + </complexType> + </element> + <element name="SubscriptionHeader" type="anyURI"/> +</schema> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/tests/test_cases/testfiles new/xmlschema-2.3.0/tests/test_cases/testfiles --- old/xmlschema-2.2.3/tests/test_cases/testfiles 2022-07-18 16:19:15.000000000 +0200 +++ new/xmlschema-2.3.0/tests/test_cases/testfiles 2023-05-18 22:18:16.000000000 +0200 @@ -39,11 +39,15 @@ features/decoder/data4-mixed.xml features/derivations/complex-extensions.xsd --errors=1 +features/derivations/complex11-restrictions.xsd --version=1.1 features/derivations/complex-with-simple-content-restriction.xsd features/derivations/list_types.xsd --errors=1 features/derivations/list_types.xml --errors=2 -features/derivations/invalid_enumeration_restriction.xsd --errors=1 -features/derivations/invalid_restrictions1.xsd --errors=2 +features/derivations/invalid-enumeration-restriction.xsd --errors=1 +features/derivations/invalid-restrictions1.xsd --errors=2 +features/derivations/invalid-restrictions1.xsd --version=1.1 --errors=1 +features/derivations/invalid-restrictions2.xsd --errors=1 +features/derivations/invalid-restrictions2.xsd --version=1.1 --errors=1 features/elements/type_alternatives.xsd --errors=3 features/elements/type_alternatives.xsd --version=1.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/tests/test_typing.py new/xmlschema-2.3.0/tests/test_typing.py --- old/xmlschema-2.2.3/tests/test_typing.py 2022-05-20 18:16:20.000000000 +0200 +++ new/xmlschema-2.3.0/tests/test_typing.py 2023-05-18 22:18:16.000000000 +0200 @@ -11,53 +11,54 @@ """Tests about static typing of xmlschema objects.""" import unittest -import subprocess -import re +import importlib from pathlib import Path try: - import mypy + from mypy import api as mypy_api except ImportError: - mypy = None + mypy_api = None +try: + lxml_stubs_module = importlib.import_module('lxml-stubs') +except ImportError: + lxml_stubs_module = None -@unittest.skipIf(mypy is None, "mypy is not installed") + +@unittest.skipIf(mypy_api is None, "mypy is not installed") +@unittest.skipIf(lxml_stubs_module is None, "lxml-stubs is not installed") class TestTyping(unittest.TestCase): @classmethod def setUpClass(cls): cls.cases_dir = Path(__file__).parent.joinpath('test_cases/mypy') cls.config_file = Path(__file__).parent.parent.joinpath('mypy.ini') - cls.error_pattern = re.compile(r'Found \d+ error', re.IGNORECASE) - - def check_mypy_output(self, testfile, *options): - cmd = ['mypy', '--config-file', str(self.config_file), testfile] - if options: - cmd.extend(str(opt) for opt in options) - process = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - - self.assertEqual(process.stderr, b'') - output = process.stdout.decode('utf-8').strip() - output_lines = output.split('\n') - - self.assertGreater(len(output_lines), 0, msg=output) - self.assertNotRegex(output_lines[-1], self.error_pattern, msg=output) - return output_lines def test_schema_source(self): - case_path = self.cases_dir.joinpath('schema_source.py') - output_lines = self.check_mypy_output(case_path, '--strict', '--no-warn-unused-ignores') - self.assertTrue(output_lines[0].startswith('Success:'), msg='\n'.join(output_lines)) + result = mypy_api.run([ + '--strict', + '--no-warn-unused-ignores', + '--config-file', str(self.config_file), + str(self.cases_dir.joinpath('schema_source.py')) + ]) + self.assertEqual(result[2], 0, msg=result[1] or result[0]) def test_simple_types(self): - case_path = self.cases_dir.joinpath('simple_types.py') - output_lines = self.check_mypy_output(case_path, '--strict', '--no-warn-unused-ignores') - self.assertTrue(output_lines[0].startswith('Success:'), msg='\n'.join(output_lines)) + result = mypy_api.run([ + '--strict', + '--no-warn-unused-ignores', + '--config-file', str(self.config_file), + str(self.cases_dir.joinpath('simple_types.py')) + ]) + self.assertEqual(result[2], 0, msg=result[1] or result[0]) def test_extra_validator__issue_291(self): - case_path = self.cases_dir.joinpath('extra_validator.py') - output_lines = self.check_mypy_output(case_path, '--strict') - self.assertTrue(output_lines[0].startswith('Success:'), msg='\n'.join(output_lines)) + result = mypy_api.run([ + '--strict', + '--config-file', str(self.config_file), + str(self.cases_dir.joinpath('extra_validator.py')) + ]) + self.assertEqual(result[2], 0, msg=result[1] or result[0]) if __name__ == '__main__': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/tests/test_wsdl.py new/xmlschema-2.3.0/tests/test_wsdl.py --- old/xmlschema-2.2.3/tests/test_wsdl.py 2022-07-18 16:19:15.000000000 +0200 +++ new/xmlschema-2.3.0/tests/test_wsdl.py 2023-05-18 22:18:16.000000000 +0200 @@ -258,6 +258,19 @@ port = wsdl_document.services[service_name].ports['StockQuotePort'] self.assertEqual(port.soap_location, 'mailto:subscr...@example.com') + def test_example3_without_types__issue_347(self): + no_types_file = casepath('features/wsdl/wsdl11_example3_no_types.wsdl') + with self.assertRaises(WsdlParseError): + Wsdl11Document(no_types_file) + + schema_file = casepath('features/wsdl/wsdl11_example3_types.xsd') + wsdl_document = Wsdl11Document(no_types_file, schema=schema_file) + + self.assertIn('{http://example.com/stockquote.xsd}SubscribeToQuotes', + wsdl_document.schema.maps.elements) + self.assertIn('{http://example.com/stockquote.xsd}SubscriptionHeader', + wsdl_document.schema.maps.elements) + def test_example4(self): original_example4_file = casepath('features/wsdl/wsdl11_example4.wsdl') with self.assertRaises(XMLSchemaValidationError): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/tests/validators/test_groups.py new/xmlschema-2.3.0/tests/validators/test_groups.py --- old/xmlschema-2.2.3/tests/validators/test_groups.py 2021-10-20 16:14:48.000000000 +0200 +++ new/xmlschema-2.3.0/tests/validators/test_groups.py 2023-05-18 22:18:16.000000000 +0200 @@ -30,6 +30,10 @@ def __repr__(self) -> str: return '%s(model=%r, occurs=%r)' % (self.__class__.__name__, self.model, self.occurs) + @property + def xsd_version(self) -> str: + return '1.0' + append: Any diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/tox.ini new/xmlschema-2.3.0/tox.ini --- old/xmlschema-2.2.3/tox.ini 2023-04-14 15:49:05.000000000 +0200 +++ new/xmlschema-2.3.0/tox.ini 2023-05-18 22:18:16.000000000 +0200 @@ -1,12 +1,12 @@ [tox] -envlist = py{37,38,39,310,311,312,py3}, ep{40}, docs, +envlist = py{37,38,39,310,311,312,py3}, docs, flake8, mypy-py{37,38,39,310,311,312,py3}, coverage, pytest skip_missing_interpreters = true work_dir = {tox_root}/../.tox/xmlschema [testenv] deps = - elementpath>=4.0.0, <5.0.0 + elementpath>=4.1.2, <5.0.0 lxml jinja2 py{310,311}: memory_profiler @@ -18,15 +18,10 @@ [testenv:py312] deps = - elementpath>=4.0.0, <5.0.0 + elementpath>=4.1.2, <5.0.0 # lxml: skip for now jinja2 -[testenv:ep40] -deps = - elementpath~=4.0.0 - lxml - [testenv:docs] commands = make -C doc html SPHINXOPTS="-W -n" @@ -47,8 +42,8 @@ [testenv:mypy-py37] deps = - mypy==1.2.0 - elementpath==4.1.1 + mypy==1.3.0 + elementpath==4.1.2 lxml-stubs jinja2 commands = @@ -56,8 +51,8 @@ [testenv:mypy-py{38,39,310,311,312,py3}] deps = - mypy==1.2.0 - elementpath==4.1.1 + mypy==1.3.0 + elementpath==4.1.2 lxml-stubs jinja2 commands = @@ -74,10 +69,10 @@ deps = pytest pytest-randomly - elementpath>=4.0.0, <5.0.0 + elementpath>=4.1.2, <5.0.0 lxml jinja2 - mypy==1.2.0 + mypy==1.3.0 lxml-stubs commands = pytest tests -ra diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/xmlschema/__init__.py new/xmlschema-2.3.0/xmlschema/__init__.py --- old/xmlschema-2.2.3/xmlschema/__init__.py 2023-04-14 15:49:05.000000000 +0200 +++ new/xmlschema-2.3.0/xmlschema/__init__.py 2023-05-18 22:18:16.000000000 +0200 @@ -31,7 +31,7 @@ XsdComponent, XsdType, XsdElement, XsdAttribute ) -__version__ = '2.2.3' +__version__ = '2.3.0' __author__ = "Davide Brunato" __contact__ = "brun...@sissa.it" __copyright__ = "Copyright 2016-2023, SISSA" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/xmlschema/cli.py new/xmlschema-2.3.0/xmlschema/cli.py --- old/xmlschema-2.2.3/xmlschema/cli.py 2022-07-18 16:19:15.000000000 +0200 +++ new/xmlschema-2.3.0/xmlschema/cli.py 2023-05-18 22:18:16.000000000 +0200 @@ -6,7 +6,7 @@ # # @author Davide Brunato <brun...@sissa.it> # -# type: ignore +# mypy: ignore-errors """Command Line Interface""" import sys import os diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/xmlschema/documents.py new/xmlschema-2.3.0/xmlschema/documents.py --- old/xmlschema-2.2.3/xmlschema/documents.py 2023-02-06 07:20:42.000000000 +0100 +++ new/xmlschema-2.3.0/xmlschema/documents.py 2023-05-18 22:18:16.000000000 +0200 @@ -543,6 +543,9 @@ :param defuse: the defuse mode for base :class:`xmlschema.XMLResource` initialization. :param timeout: the timeout for base :class:`xmlschema.XMLResource` initialization. :param lazy: the lazy mode for base :class:`xmlschema.XMLResource` initialization. + :param use_location_hints: for default, in case a schema instance has \ + to be built, uses also schema locations hints provided within XML data. \ + Set this option to `False` to ignore these schema location hints. """ schema: Optional[XMLSchemaBase] = None _fallback_schema: Optional[XMLSchemaBase] = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/xmlschema/extras/codegen.py new/xmlschema-2.3.0/xmlschema/extras/codegen.py --- old/xmlschema-2.2.3/xmlschema/extras/codegen.py 2023-02-11 10:04:58.000000000 +0100 +++ new/xmlschema-2.3.0/xmlschema/extras/codegen.py 2023-05-18 22:18:16.000000000 +0200 @@ -7,7 +7,7 @@ # # @author Davide Brunato <brun...@sissa.it> # -# type: ignore +# mypy: ignore-errors """ This module contains abstact base class and helper functions for building XSD based code generators. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/xmlschema/extras/wsdl.py new/xmlschema-2.3.0/xmlschema/extras/wsdl.py --- old/xmlschema-2.2.3/xmlschema/extras/wsdl.py 2022-06-24 16:13:22.000000000 +0200 +++ new/xmlschema-2.3.0/xmlschema/extras/wsdl.py 2023-05-18 22:18:16.000000000 +0200 @@ -7,7 +7,7 @@ # # @author Davide Brunato <brun...@sissa.it> # -# type: ignore +# mypy: ignore-errors import os from ..exceptions import XMLSchemaException, XMLSchemaValueError @@ -17,7 +17,7 @@ from ..namespaces import NamespaceResourcesMap from ..resources import fetch_resource from ..documents import XmlDocument -from ..validators import XMLSchema10 +from ..validators import XMLSchemaBase, XMLSchema10 # WSDL 1.1 global declarations @@ -463,6 +463,9 @@ :param source: a string containing XML data or a file path or an URL or a \ file like object or an ElementTree or an Element. + :param schema: additional schema for providing XSD types and elements to the \ + WSDL document. Can be a :class:`xmlschema.XMLSchema` instance or a file-like \ + object or a file path or a URL of a resource or a string containing the XSD schema. :param cls: class to use for building the schema instance (for default \ :class:`xmlschema.XMLSchema10` is used). :param validation: the XSD validation mode to use for validating the XML document, \ @@ -479,17 +482,30 @@ target_namespace = '' soap_binding = False - def __init__(self, source, cls=None, validation='strict', namespaces=None, maps=None, - locations=None, base_url=None, allow='all', defuse='remote', timeout=300): + def __init__(self, source, schema=None, cls=None, validation='strict', + namespaces=None, maps=None, locations=None, base_url=None, + allow='all', defuse='remote', timeout=300): - if maps is None: + if maps is not None: + self.maps = maps + self.schema = maps.wsdl_document.schema + else: if cls is None: cls = XMLSchema10 - self.schema = cls(source=os.path.join(SCHEMAS_DIR, 'WSDL/wsdl.xsd')) + + if isinstance(schema, XMLSchemaBase): + cls = schema.__class__ + global_maps = schema.maps + elif schema is not None: + global_maps = cls(schema).maps + else: + global_maps = None + + self.schema = cls( + source=os.path.join(SCHEMAS_DIR, 'WSDL/wsdl.xsd'), + global_maps=global_maps, + ) self.maps = Wsdl11Maps(self) - else: - self.schema = maps.wsdl_document.schema - self.maps = maps if locations: self.locations = NamespaceResourcesMap(locations) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/xmlschema/testing/__init__.py new/xmlschema-2.3.0/xmlschema/testing/__init__.py --- old/xmlschema-2.2.3/xmlschema/testing/__init__.py 2022-03-07 14:26:41.000000000 +0100 +++ new/xmlschema-2.3.0/xmlschema/testing/__init__.py 2023-05-18 22:18:16.000000000 +0200 @@ -7,7 +7,7 @@ # # @author Davide Brunato <brun...@sissa.it> # -# type: ignore +# mypy: ignore-errors """ Subpackage with unittest extensions for xmlschema. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/xmlschema/testing/_builders.py new/xmlschema-2.3.0/xmlschema/testing/_builders.py --- old/xmlschema-2.2.3/xmlschema/testing/_builders.py 2022-07-18 16:19:15.000000000 +0200 +++ new/xmlschema-2.3.0/xmlschema/testing/_builders.py 2023-05-18 22:18:16.000000000 +0200 @@ -7,7 +7,7 @@ # # @author Davide Brunato <brun...@sissa.it> # -# type: ignore +# mypy: ignore-errors import pdb import os import ast diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/xmlschema/testing/_case_class.py new/xmlschema-2.3.0/xmlschema/testing/_case_class.py --- old/xmlschema-2.2.3/xmlschema/testing/_case_class.py 2022-07-18 16:19:15.000000000 +0200 +++ new/xmlschema-2.3.0/xmlschema/testing/_case_class.py 2023-05-18 22:18:16.000000000 +0200 @@ -7,7 +7,7 @@ # # @author Davide Brunato <brun...@sissa.it> # -# type: ignore +# mypy: ignore-errors """ Tests subpackage module: common definitions for unittest scripts of the 'xmlschema' package. """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/xmlschema/testing/_factory.py new/xmlschema-2.3.0/xmlschema/testing/_factory.py --- old/xmlschema-2.2.3/xmlschema/testing/_factory.py 2022-03-07 14:26:41.000000000 +0100 +++ new/xmlschema-2.3.0/xmlschema/testing/_factory.py 2023-05-18 22:18:16.000000000 +0200 @@ -7,7 +7,7 @@ # # @author Davide Brunato <brun...@sissa.it> # -# type: ignore +# mypy: ignore-errors """ Test factory for creating test cases from lists of paths to XSD or XML files. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/xmlschema/testing/_observers.py new/xmlschema-2.3.0/xmlschema/testing/_observers.py --- old/xmlschema-2.2.3/xmlschema/testing/_observers.py 2022-03-07 14:26:41.000000000 +0100 +++ new/xmlschema-2.3.0/xmlschema/testing/_observers.py 2023-05-18 22:18:16.000000000 +0200 @@ -7,7 +7,7 @@ # # @author Davide Brunato <brun...@sissa.it> # -# type: ignore +# mypy: ignore-errors """ Observers for testing XMLSchema classes. """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/xmlschema/validators/groups.py new/xmlschema-2.3.0/xmlschema/validators/groups.py --- old/xmlschema-2.2.3/xmlschema/validators/groups.py 2023-04-14 15:49:05.000000000 +0200 +++ new/xmlschema-2.3.0/xmlschema/validators/groups.py 2023-05-18 22:18:16.000000000 +0200 @@ -13,8 +13,8 @@ import warnings from collections.abc import MutableMapping from copy import copy as _copy -from typing import TYPE_CHECKING, overload, Any, Iterable, Iterator, List, \ - MutableSequence, Optional, Tuple, Union +from typing import TYPE_CHECKING, cast, overload, Any, Iterable, Iterator, \ + List, MutableSequence, Optional, Tuple, Union from xml.etree import ElementTree from .. import limits @@ -196,13 +196,27 @@ def effective_min_occurs(self) -> int: if not self.min_occurs or not self: return 0 + + effective_items: List[Any] + min_occurs: int + effective_items = [e for e in self.iter_model() if e.effective_max_occurs != 0] + if not effective_items: + return 0 elif self.model == 'choice': - if any(not e.effective_min_occurs for e in self.iter_model()): - return 0 - else: - if all(not e.effective_min_occurs for e in self.iter_model()): - return 0 - return self.min_occurs + min_occurs = min(e.effective_min_occurs for e in effective_items) + return self.min_occurs * min_occurs + elif self.model == 'all': + min_occurs = max(e.effective_min_occurs for e in effective_items) + return min_occurs + + not_emptiable_items = [e for e in effective_items if e.effective_min_occurs] + if not not_emptiable_items: + return 0 + elif len(not_emptiable_items) > 1: + return self.min_occurs + + min_occurs = not_emptiable_items[0].effective_min_occurs + return self.min_occurs * min_occurs @property def effective_max_occurs(self) -> Optional[int]: @@ -210,35 +224,41 @@ return 0 effective_items: List[Any] - value: int + max_occurs: int - effective_items = [e for e in self.iter_model() if e.effective_max_occurs != 0] + model_items = [(e, e.effective_max_occurs) for e in self.iter_model()] + effective_items = [x for x in model_items if x[1] != 0] if not effective_items: return 0 elif self.max_occurs is None: return None elif self.model == 'choice': - try: - value = max(e.effective_max_occurs for e in effective_items) - except TypeError: + if any(x[1] is None for x in effective_items): return None else: - return self.max_occurs * value + max_occurs = max(x[1] for x in effective_items) + return self.max_occurs * max_occurs - not_emptiable_items = [e for e in effective_items if e.effective_min_occurs] + not_emptiable_items = [x for x in effective_items if x[0].effective_min_occurs] if not not_emptiable_items: - try: - value = max(e.effective_max_occurs for e in effective_items) - except TypeError: + if any(x[1] is None for x in effective_items): return None else: - return self.max_occurs * value + max_occurs = max(x[1] for x in effective_items) + return self.max_occurs * max_occurs elif len(not_emptiable_items) > 1: - return self.max_occurs - - value = not_emptiable_items[0].effective_max_occurs - return None if value is None else self.max_occurs * value + if self.model == 'sequence': + return self.max_occurs + elif all(x[1] is None for x in not_emptiable_items): + return None + else: + max_occurs = min(x[1] for x in not_emptiable_items if x[1] is not None) + return max_occurs + elif not_emptiable_items[0][1] is None: + return None + else: + return self.max_occurs * cast(int, not_emptiable_items[0][1]) def has_occurs_restriction( self, other: Union[ModelParticleType, ParticleMixin, 'OccursCalculator']) -> bool: @@ -1280,6 +1300,26 @@ else: # other.model == 'choice': return self.is_choice_restriction(other) + def has_occurs_restriction( + self, other: Union[ModelParticleType, ParticleMixin, 'OccursCalculator']) -> bool: + if not isinstance(other, XsdGroup): + return super().has_occurs_restriction(other) + elif not self: + return True + elif self.effective_min_occurs < other.effective_min_occurs: + return False + + effective_max_occurs = self.effective_max_occurs + if effective_max_occurs == 0: + return True + elif effective_max_occurs is None: + return other.effective_max_occurs is None + + try: + return effective_max_occurs <= other.effective_max_occurs # type: ignore[operator] + except TypeError: + return True + def is_sequence_restriction(self, other: XsdGroup) -> bool: if not self.has_occurs_restriction(other): return False @@ -1306,12 +1346,22 @@ if item is not None and item.is_restriction(other_item, check_occurs): item = next(item_iterator, None) elif not other_item.is_emptiable(): + break + else: + if item is None: + return True + + # Restriction check failed again: try checking other items against self + other_items = other.iter_model() + for other_item in other_items: + if self.is_restriction(other_item, check_occurs): + return all(x.is_emptiable() for x in other_items) + elif not other_item.is_emptiable(): return False - return item is None + else: + return False def is_all_restriction(self, other: XsdGroup) -> bool: - if not self.has_occurs_restriction(other): - return False restriction_items = [x for x in self.iter_model()] base_items = [x for x in other.iter_model()] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/xmlschema/validators/particles.py new/xmlschema-2.3.0/xmlschema/validators/particles.py --- old/xmlschema-2.2.3/xmlschema/validators/particles.py 2022-09-08 12:16:11.000000000 +0200 +++ new/xmlschema-2.3.0/xmlschema/validators/particles.py 2023-05-18 22:18:16.000000000 +0200 @@ -44,7 +44,8 @@ """ A property calculated from minOccurs, that is equal to minOccurs for elements and may vary for content model groups, in dependance - of group model and structure. + of group model and structure. Used for checking restrictions of + model groups in XSD 1.1. """ return self.min_occurs @@ -54,7 +55,7 @@ A property calculated from maxOccurs, that is equal to maxOccurs for elements and may vary for content model groups, in dependance of group model and structure. Used for checking restrictions of - xs:choice model groups in XSD 1.1. + model groups in XSD 1.1. """ return self.max_occurs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/xmlschema.egg-info/PKG-INFO new/xmlschema-2.3.0/xmlschema.egg-info/PKG-INFO --- old/xmlschema-2.2.3/xmlschema.egg-info/PKG-INFO 2023-04-14 15:52:42.000000000 +0200 +++ new/xmlschema-2.3.0/xmlschema.egg-info/PKG-INFO 2023-05-18 22:19:54.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: xmlschema -Version: 2.2.3 +Version: 2.3.0 Summary: An XML Schema validator and decoder Home-page: https://github.com/sissaschool/xmlschema Author: Davide Brunato diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/xmlschema.egg-info/SOURCES.txt new/xmlschema-2.3.0/xmlschema.egg-info/SOURCES.txt --- old/xmlschema-2.2.3/xmlschema.egg-info/SOURCES.txt 2023-04-14 15:52:42.000000000 +0200 +++ new/xmlschema-2.3.0/xmlschema.egg-info/SOURCES.txt 2023-05-18 22:19:54.000000000 +0200 @@ -95,9 +95,10 @@ tests/test_cases/features/decoder/simple-types.xsd tests/test_cases/features/derivations/complex-extensions.xsd tests/test_cases/features/derivations/complex-with-simple-content-restriction.xsd -tests/test_cases/features/derivations/invalid_enumeration_restriction.xsd -tests/test_cases/features/derivations/invalid_restrictions1.xsd -tests/test_cases/features/derivations/invalid_restrictions2.xsd +tests/test_cases/features/derivations/complex11-restrictions.xsd +tests/test_cases/features/derivations/invalid-enumeration-restriction.xsd +tests/test_cases/features/derivations/invalid-restrictions1.xsd +tests/test_cases/features/derivations/invalid-restrictions2.xsd tests/test_cases/features/derivations/list_types.xml tests/test_cases/features/derivations/list_types.xsd tests/test_cases/features/elements/test_alternatives-1.xml @@ -146,6 +147,8 @@ tests/test_cases/features/patterns/patterns.xml tests/test_cases/features/patterns/patterns.xsd tests/test_cases/features/wsdl/wsdl11_example3.wsdl +tests/test_cases/features/wsdl/wsdl11_example3_no_types.wsdl +tests/test_cases/features/wsdl/wsdl11_example3_types.xsd tests/test_cases/features/wsdl/wsdl11_example3_valid.wsdl tests/test_cases/features/wsdl/wsdl11_example4.wsdl tests/test_cases/features/wsdl/wsdl11_example4_valid.wsdl diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-2.2.3/xmlschema.egg-info/requires.txt new/xmlschema-2.3.0/xmlschema.egg-info/requires.txt --- old/xmlschema-2.2.3/xmlschema.egg-info/requires.txt 2023-04-14 15:52:42.000000000 +0200 +++ new/xmlschema-2.3.0/xmlschema.egg-info/requires.txt 2023-05-18 22:19:54.000000000 +0200 @@ -1,14 +1,14 @@ -elementpath<5.0.0,>=4.0.0 +elementpath<5.0.0,>=4.1.2 [codegen] -elementpath<5.0.0,>=4.0.0 +elementpath<5.0.0,>=4.1.2 jinja2 [dev] tox coverage lxml -elementpath<5.0.0,>=4.0.0 +elementpath<5.0.0,>=4.1.2 memory_profiler Sphinx sphinx_rtd_theme @@ -18,7 +18,7 @@ lxml-stubs [docs] -elementpath<5.0.0,>=4.0.0 +elementpath<5.0.0,>=4.1.2 Sphinx sphinx_rtd_theme jinja2