From c0172fdeb03295523fecf7b426c782facc31ec4c Mon Sep 17 00:00:00 2001 From: Marko Hauptvogel Date: Thu, 23 Jul 2026 20:54:45 +0200 Subject: [PATCH 1/2] fix: renderpath for type-extensions The `child_path` variable can still be set from the attribute loop above, but then it has the wrong value. Without any attributes it is unset and causes an UnboundLocalError. Set it always to a proper value. Fixes: 0c8a3fc4f9a8 ("Add support to pass base-types to type extensions") --- src/zeep/xsd/types/complex.py | 1 + tests/test_xsd_complex_types.py | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/zeep/xsd/types/complex.py b/src/zeep/xsd/types/complex.py index 776fdeb02..d63f94cab 100644 --- a/src/zeep/xsd/types/complex.py +++ b/src/zeep/xsd/types/complex.py @@ -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 diff --git a/tests/test_xsd_complex_types.py b/tests/test_xsd_complex_types.py index 55430c91f..647679208 100644 --- a/tests/test_xsd_complex_types.py +++ b/tests/test_xsd_complex_types.py @@ -365,6 +365,39 @@ def test_xml_simple_content_nil(): assert obj._value_1 is None +def test_xml_simple_content_extension_render(): + schema = xsd.Schema( + load_xml( + """ + + + + + + + + + + + """ + ) + ) + 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 = """ + + my-test-value + + """ + assert_nodes_equal(result, expected) + + def test_ignore_sequence_order(): schema_doc = load_xml( b""" From 71761c8db1809b9fd35f739d773fb6acd5c7e786 Mon Sep 17 00:00:00 2001 From: Marko Hauptvogel Date: Mon, 31 Aug 2026 13:13:09 +0200 Subject: [PATCH 2/2] fix: redudantant function call in test_xml_simple_content_nil MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The side-effect free function `render_node(…)` is called twice, remove the second call. Fixes: d88d4272ee89 ("When Nil is set on an element which is built …") --- tests/test_xsd_complex_types.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_xsd_complex_types.py b/tests/test_xsd_complex_types.py index 647679208..de7d351df 100644 --- a/tests/test_xsd_complex_types.py +++ b/tests/test_xsd_complex_types.py @@ -358,7 +358,6 @@ def test_xml_simple_content_nil(): """ - result = render_node(container_elm, obj) assert_nodes_equal(result, expected) obj = container_elm.parse(result[0], schema)