diff --git a/src/Nirum/Targets/Python.hs b/src/Nirum/Targets/Python.hs index 8fdb663..4e963de 100644 --- a/src/Nirum/Targets/Python.hs +++ b/src/Nirum/Targets/Python.hs @@ -1123,6 +1123,12 @@ class {className}_Client($className): self.__nirum_transport__ = transport # type: transport_type {clientMethods'} + +{className}.Client = {className}_Client +if hasattr({className}.Client, '__qualname__'): + {className}.Client.__qualname__ = '{className}.Client' +else: + {className}.Client.__name__ = 'Client' |] where nirumMapName :: T.Text diff --git a/test/python/service_test.py b/test/python/service_test.py index ca8d3f7..25c4b1f 100644 --- a/test/python/service_test.py +++ b/test/python/service_test.py @@ -1,9 +1,10 @@ import uuid from nirum.transport import Transport +from six import PY2 from fixture.foo import (Dog, Gender, PingService, Product, RpcError, - SampleService_Client, Way) + SampleService, SampleService_Client, Way) def test_throws_error(): @@ -48,7 +49,8 @@ def latest_call(self): def test_service_client_payload_serialization(): t = DumbTransport() - c = SampleService_Client(t) + c = SampleService.Client(t) + assert SampleService_Client is SampleService.Client c.sample_method( a=Dog(name=u'Dog.name', age=3), b=Product(name=u'Product.name', sale=False), @@ -83,3 +85,11 @@ def test_service_client_payload_serialization(): 'g': 1234, 'hh': 'text data', } + + +def test_service_client_representation(): + if PY2: + assert repr(SampleService.Client) == "" + else: + assert repr(SampleService.Client) == \ + ""