Skip to content

Commit 592a831

Browse files
authored
Merge pull request #1 from bozokopic/main
Fix element signature for builtin AnyType
2 parents 41a5115 + fbcae2c commit 592a831

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/zeep/xsd/elements/element.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ def resolve(self):
309309
def signature(self, schema=None, standalone=True):
310310
from zeep.xsd import ComplexType
311311

312-
if self.type.is_global or (not standalone and self.is_global):
312+
if ((self.type.is_global and self.type.qname is not None) or
313+
(not standalone and self.is_global)):
313314
value = self.type.get_prefixed_name(schema)
314315
else:
315316
value = self.type.signature(schema, standalone=False)

tests/test_xsd_signatures.py

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import pytest
12
from lxml import etree
23

34
from tests.utils import load_xml
@@ -289,3 +290,14 @@ def test_schema_recursive_ref():
289290

290291
elm = schema.get_element("ns0:Container")
291292
elm.signature(schema)
293+
294+
295+
@pytest.mark.parametrize('default_type', xsd.default_types.values())
296+
@pytest.mark.parametrize('standalone', [True, False])
297+
def test_signature_builtin_type(default_type, standalone):
298+
builtin_type = xsd.Element(
299+
etree.QName("http://tests.python-zeep.org/", "authentication"),
300+
default_type
301+
)
302+
signature = builtin_type.signature(standalone=standalone)
303+
assert isinstance(signature, str)

0 commit comments

Comments
 (0)