diff --git a/src/zeep/xsd/elements/element.py b/src/zeep/xsd/elements/element.py index 1650f75a..a72d04f7 100644 --- a/src/zeep/xsd/elements/element.py +++ b/src/zeep/xsd/elements/element.py @@ -309,7 +309,8 @@ def resolve(self): def signature(self, schema=None, standalone=True): from zeep.xsd import ComplexType - if self.type.is_global or (not standalone and self.is_global): + if ((self.type.is_global and self.type.qname is not None) or + (not standalone and self.is_global)): value = self.type.get_prefixed_name(schema) else: value = self.type.signature(schema, standalone=False) diff --git a/tests/test_xsd_signatures.py b/tests/test_xsd_signatures.py index 48f3be8e..e21133de 100644 --- a/tests/test_xsd_signatures.py +++ b/tests/test_xsd_signatures.py @@ -1,3 +1,4 @@ +import pytest from lxml import etree from tests.utils import load_xml @@ -289,3 +290,14 @@ def test_schema_recursive_ref(): elm = schema.get_element("ns0:Container") elm.signature(schema) + + +@pytest.mark.parametrize('default_type', xsd.default_types.values()) +@pytest.mark.parametrize('standalone', [True, False]) +def test_signature_builtin_type(default_type, standalone): + builtin_type = xsd.Element( + etree.QName("http://tests.python-zeep.org/", "authentication"), + default_type + ) + signature = builtin_type.signature(standalone=standalone) + assert isinstance(signature, str)