Skip to content

Commit 08898b3

Browse files
author
y1thof
committed
add signature to OperationProxy docstring
1 parent 6961e76 commit 08898b3

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/zeep/client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ class OperationProxy(object):
1313
def __init__(self, service_proxy, operation_name):
1414
self._proxy = service_proxy
1515
self._op_name = operation_name
16-
self.__doc__ = 'OperationProxy for %s' % operation_name
16+
try:
17+
signature = str(self._proxy._binding._operations[operation_name])
18+
self.__doc__ = signature
19+
except:
20+
self.__doc__ = 'OperationProxy for %s' % operation_name
1721

1822
def __call__(self, *args, **kwargs):
1923
"""Call the operation with the given args and kwargs.

tests/test_client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ def test_service_proxy_dir_operations():
4949
assert set(operations) == set(['GetLastTradePrice', 'GetLastTradePriceNoOutput'])
5050

5151

52+
def test_operation_proxy_doc():
53+
client_obj = client.Client('tests/wsdl_files/soap.wsdl')
54+
assert (client_obj.service.GetLastTradePrice.__doc__
55+
== 'GetLastTradePrice(tickerSymbol: xsd:string, '
56+
'account: ns0:account, '
57+
'country: ns0:country) -> price: xsd:float')
58+
59+
5260
def test_open_from_file_object():
5361
with open('tests/wsdl_files/soap_transport_err.wsdl', 'rb') as fh:
5462
client_obj = client.Client(fh)

0 commit comments

Comments
 (0)