Skip to content

Commit

Permalink
Code cleaning and package dependencies update
Browse files Browse the repository at this point in the history
  • Loading branch information
brunato committed May 5, 2019
1 parent 149a1e4 commit 3f47092
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Requirements for setup a development environment for the xmlschema package.
setuptools
tox
elementpath~=1.1.5
elementpath~=1.1.7
lxml
memory_profiler
pathlib2 # For Py27 tests on resources
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def run(self):
setup(
name='xmlschema',
version='1.0.11',
install_requires=['elementpath~=1.1.5'],
install_requires=['elementpath~=1.1.7'],
packages=['xmlschema'],
include_package_data=True,
cmdclass={
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ toxworkdir = {homedir}/.tox/xmlschema
[testenv]
deps =
lxml
elementpath~=1.1.5
elementpath~=1.1.7
commands = python xmlschema/tests/test_all.py {posargs}

[testenv:py27]
deps =
lxml
elementpath~=1.1.5
elementpath~=1.1.7
pathlib2
commands = python xmlschema/tests/test_all.py {posargs}
2 changes: 1 addition & 1 deletion xmlschema/tests/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ def test_union_types(self):
# For testing issue #103
decimal_or_nan = self.st_schema.types['myType']
self.check_decode(decimal_or_nan, '95.0', Decimal('95.0'))
self.check_decode(decimal_or_nan, 'NaN', 'NaN')
self.check_decode(decimal_or_nan, 'NaN', u'NaN')


class TestDecoding11(TestDecoding):
Expand Down
1 change: 1 addition & 0 deletions xmlschema/tests/test_w3c_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
####
# Tests that are incompatible with XSD meta-schema validation or that are postponed
SKIPPED_TESTS = {
# Signed as valid that have to be checked
'../msData/additional/addB194.xsd', # 4826: invalid xml:lang='enu'
'../msData/particles/particlesZ001.xsd', # 10957: Invalid in XSD 1.0
'../msData/simpleType/stE110.xsd', # 13892: Circular xs:union declaration
Expand Down
13 changes: 2 additions & 11 deletions xmlschema/validators/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from .xsdbase import ValidationMixin, XsdComponent, XsdType
from .elements import XsdElement
from .wildcards import XsdAnyElement
from .models import ParticleMixin, ModelGroup, ModelVisitor
from .models import MAX_MODEL_DEPTH, ParticleMixin, ModelGroup, ModelVisitor

ANY_ELEMENT = etree_element(
XSD_ANY,
Expand Down Expand Up @@ -495,17 +495,8 @@ def is_choice_restriction(self, other):
else:
return other_max_occurs >= max_occurs * self.max_occurs

def iter_subelements(self, depth=0):
if depth <= 15:
for item in self:
if isinstance(item, XsdGroup):
for e in item.iter_subelements(depth+1):
yield e
else:
yield item

def iter_elements(self, depth=0):
if depth <= 15:
if depth <= MAX_MODEL_DEPTH:
for item in self:
if isinstance(item, XsdGroup):
for e in item.iter_elements(depth+1):
Expand Down
9 changes: 9 additions & 0 deletions xmlschema/validators/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ def iter_elements(self, depth=0):
else:
yield item

def iter_subelements(self, depth=0):
if depth <= MAX_MODEL_DEPTH:
for item in self:
if isinstance(item, ModelGroup):
for e in item.iter_subelements(depth+1):
yield e
else:
yield item

def check_model(self):
"""
Checks if the model group is deterministic. Types matching of same elements and Unique Particle
Expand Down

0 comments on commit 3f47092

Please sign in to comment.