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
3 changes: 2 additions & 1 deletion src/zeep/xsd/elements/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions tests/test_xsd_signatures.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pytest
from lxml import etree

from tests.utils import load_xml
Expand Down Expand Up @@ -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)