Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/zeep/xsd/types/complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ def render(
and not isinstance(value, (list, dict, CompoundValue))
):
element = self.elements_nested[0][1]
child_path = render_path + [element.name]
element.type.render(node, value, None, child_path)
return

Expand Down
34 changes: 33 additions & 1 deletion tests/test_xsd_complex_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,13 +358,45 @@ def test_xml_simple_content_nil():
<ns0:container xmlns:ns0="http://tests.python-zeep.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
</document>
"""
result = render_node(container_elm, obj)
assert_nodes_equal(result, expected)

obj = container_elm.parse(result[0], schema)
assert obj._value_1 is None


def test_xml_simple_content_extension_render():
schema = xsd.Schema(
load_xml(
"""
<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://tests.python-zeep.org/"
targetNamespace="http://tests.python-zeep.org/"
elementFormDefault="qualified">
<element name="container">
<complexType>
<simpleContent>
<extension base="string" />
</simpleContent>
</complexType>
</element>
</schema>
"""
)
)
schema.set_ns_prefix("tns", "http://tests.python-zeep.org/")
container_elm = schema.get_element("tns:container")

result = render_node(container_elm, "my-test-value")

expected = """
<document>
<ns0:container xmlns:ns0="http://tests.python-zeep.org/">my-test-value</ns0:container>
</document>
"""
assert_nodes_equal(result, expected)


def test_ignore_sequence_order():
schema_doc = load_xml(
b"""
Expand Down