python-zeep icon indicating copy to clipboard operation
python-zeep copied to clipboard

Added check for nil in ComplexType

Open mcwladkoe opened this issue 7 years ago • 7 comments

parse_xmlelement "" returns empty object not None

mcwladkoe avatar May 17 '18 11:05 mcwladkoe

It seems to me that there was a bug, because with the nullable instance in WSDL the wrong result is returned (with allow_nullable = True, it is expected to None, but we get an empty instance) The solution can be such, or it is necessary to call the parent function from AnyType.

mcwladkoe avatar May 17 '18 11:05 mcwladkoe

Can you add a unittest?

mvantellingen avatar May 28 '18 20:05 mvantellingen

Codecov Report

Merging #753 into master will decrease coverage by 0.06%. The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #753      +/-   ##
==========================================
- Coverage   89.32%   89.26%   -0.07%     
==========================================
  Files          65       63       -2     
  Lines        4845     4678     -167     
  Branches      850      823      -27     
==========================================
- Hits         4328     4176     -152     
+ Misses        333      323      -10     
+ Partials      184      179       -5
Impacted Files Coverage Δ
src/zeep/xsd/types/complex.py 93.77% <100%> (+0.02%) :arrow_up:
src/zeep/asyncio/__init__.py 0% <0%> (-100%) :arrow_down:
src/zeep/exceptions.py 89.06% <0%> (-3.13%) :arrow_down:
src/zeep/xsd/elements/element.py 86.84% <0%> (-3.04%) :arrow_down:
src/zeep/client.py 80.48% <0%> (-2.44%) :arrow_down:
src/zeep/wsse/signature.py 93.1% <0%> (-1.24%) :arrow_down:
src/zeep/wsdl/messages/xop.py 81.25% <0%> (-1.11%) :arrow_down:
src/zeep/xsd/elements/indicators.py 93.13% <0%> (-0.54%) :arrow_down:
src/zeep/transports.py 72.3% <0%> (-0.42%) :arrow_down:
src/zeep/tornado/transport.py 67.94% <0%> (-0.41%) :arrow_down:
... and 43 more

codecov[bot] avatar Jun 05 '18 09:06 codecov[bot]

Added test_xml_simple_content_nil_allow_nil if written logic contradicts yours - I wait for suggestions

mcwladkoe avatar Jun 05 '18 09:06 mcwladkoe

I had the same issue and it is also described in https://github.com/mvantellingen/python-zeep/issues/823 Was going to submit a fix then realized it would duplicate this one. @mcwladkoe can you please merge from master and resubmit your PR? Thanks

artur-martirosyan avatar Jun 06 '19 22:06 artur-martirosyan

@mvantellingen I've updated to the latest master, could you please review this Pull Request once again?

mcwladkoe avatar Jun 27 '19 08:06 mcwladkoe

@mvantellingen The problem still occurs. After copying the code from this pull request into zeep library, the xml parses correctly. Could you please merge it? I need this change in my project.

g1sky avatar Sep 22 '23 07:09 g1sky