From b4827beba4904178e575752d704382efa82cc162 Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 22 Feb 2018 20:59:45 +0800 Subject: [PATCH] update python petstore samples --- .../python-asyncio/.swagger-codegen/VERSION | 2 +- .../petstore/python-asyncio/docs/FakeApi.md | 4 +- .../docs/FakeClassnameTags123Api.md | 2 + .../petstore/python-asyncio/docs/UserApi.md | 4 +- .../python-asyncio/petstore_api/__init__.py | 2 +- .../api/fake_classname_tags_123_api.py | 2 + .../petstore_api/api/user_api.py | 4 +- .../petstore_api/models/__init__.py | 2 +- .../petstore_api/models/model200_response.py | 138 ++++++++++++++++++ .../test/test_model200_response.py | 40 +++++ .../python-tornado/.swagger-codegen/VERSION | 2 +- .../petstore/python-tornado/docs/FakeApi.md | 4 +- .../docs/FakeClassnameTags123Api.md | 2 + .../petstore/python-tornado/docs/UserApi.md | 4 +- .../python-tornado/petstore_api/__init__.py | 2 +- .../api/fake_classname_tags_123_api.py | 2 + .../petstore_api/api/user_api.py | 4 +- .../petstore_api/models/__init__.py | 2 +- .../petstore_api/models/model200_response.py | 138 ++++++++++++++++++ .../python-tornado/petstore_api/rest.py | 2 +- .../test/test_model200_response.py | 40 +++++ .../petstore/python/.swagger-codegen/VERSION | 2 +- .../client/petstore/python/docs/FakeApi.md | 4 +- .../python/docs/FakeClassnameTags123Api.md | 2 + .../client/petstore/python/docs/UserApi.md | 4 +- .../petstore/python/petstore_api/__init__.py | 2 +- .../api/fake_classname_tags_123_api.py | 2 + .../python/petstore_api/api/user_api.py | 4 +- .../python/petstore_api/models/__init__.py | 2 +- .../petstore_api/models/model200_response.py | 138 ++++++++++++++++++ .../python/test/test_model200_response.py | 40 +++++ 31 files changed, 574 insertions(+), 28 deletions(-) create mode 100644 samples/client/petstore/python-asyncio/petstore_api/models/model200_response.py create mode 100644 samples/client/petstore/python-asyncio/test/test_model200_response.py create mode 100644 samples/client/petstore/python-tornado/petstore_api/models/model200_response.py create mode 100644 samples/client/petstore/python-tornado/test/test_model200_response.py create mode 100644 samples/client/petstore/python/petstore_api/models/model200_response.py create mode 100644 samples/client/petstore/python/test/test_model200_response.py diff --git a/samples/client/petstore/python-asyncio/.swagger-codegen/VERSION b/samples/client/petstore/python-asyncio/.swagger-codegen/VERSION index f9f7450d135..855ff9501eb 100644 --- a/samples/client/petstore/python-asyncio/.swagger-codegen/VERSION +++ b/samples/client/petstore/python-asyncio/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.4.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python-asyncio/docs/FakeApi.md b/samples/client/petstore/python-asyncio/docs/FakeApi.md index b910ba2b464..1da84500bfe 100644 --- a/samples/client/petstore/python-asyncio/docs/FakeApi.md +++ b/samples/client/petstore/python-asyncio/docs/FakeApi.md @@ -273,10 +273,10 @@ configuration.password = 'YOUR_PASSWORD' # create an instance of the API class api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration)) -number = 3.4 # float | None +number = 8.14 # float | None double = 1.2 # float | None pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None -byte = 'byte_example' # str | None +byte = 'B' # str | None integer = 56 # int | None (optional) int32 = 56 # int | None (optional) int64 = 789 # int | None (optional) diff --git a/samples/client/petstore/python-asyncio/docs/FakeClassnameTags123Api.md b/samples/client/petstore/python-asyncio/docs/FakeClassnameTags123Api.md index 2546c09ca4a..8d11d05085a 100644 --- a/samples/client/petstore/python-asyncio/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/python-asyncio/docs/FakeClassnameTags123Api.md @@ -12,6 +12,8 @@ Method | HTTP request | Description To test class name in snake case +To test class name in snake case + ### Example ```python from __future__ import print_function diff --git a/samples/client/petstore/python-asyncio/docs/UserApi.md b/samples/client/petstore/python-asyncio/docs/UserApi.md index 969485595ae..e9ec08e24bb 100644 --- a/samples/client/petstore/python-asyncio/docs/UserApi.md +++ b/samples/client/petstore/python-asyncio/docs/UserApi.md @@ -219,7 +219,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing. +username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing. try: # Get user by user name @@ -233,7 +233,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **str**| The name that needs to be fetched. Use user1 for testing. | + **username** | **str**| The name that needs to be fetched. Use user1 for testing. | ### Return type diff --git a/samples/client/petstore/python-asyncio/petstore_api/__init__.py b/samples/client/petstore/python-asyncio/petstore_api/__init__.py index c368867dd11..8bf367cc5b8 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/__init__.py +++ b/samples/client/petstore/python-asyncio/petstore_api/__init__.py @@ -46,7 +46,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model_200_response import Model200Response +from petstore_api.models.model200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/fake_classname_tags_123_api.py index 6b6606dc096..230aa5ec4fc 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/fake_classname_tags_123_api.py @@ -36,6 +36,7 @@ def __init__(self, api_client=None): def test_classname(self, body, **kwargs): # noqa: E501 """To test class name in snake case # noqa: E501 + To test class name in snake case # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.test_classname(body, async=True) @@ -57,6 +58,7 @@ def test_classname(self, body, **kwargs): # noqa: E501 def test_classname_with_http_info(self, body, **kwargs): # noqa: E501 """To test class name in snake case # noqa: E501 + To test class name in snake case # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.test_classname_with_http_info(body, async=True) diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/user_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/user_api.py index 89949844aa1..1de89f28bb0 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/user_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/user_api.py @@ -423,7 +423,7 @@ def get_user_by_name(self, username, **kwargs): # noqa: E501 >>> result = thread.get() :param async bool - :param str username: The name that needs to be fetched. Use user1 for testing. (required) + :param str username: The name that needs to be fetched. Use user1 for testing. (required) :return: User If the method is called asynchronously, returns the request thread. @@ -445,7 +445,7 @@ def get_user_by_name_with_http_info(self, username, **kwargs): # noqa: E501 >>> result = thread.get() :param async bool - :param str username: The name that needs to be fetched. Use user1 for testing. (required) + :param str username: The name that needs to be fetched. Use user1 for testing. (required) :return: User If the method is called asynchronously, returns the request thread. diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py b/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py index 7b339102f9b..c5ae381c40f 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py +++ b/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py @@ -34,7 +34,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model_200_response import Model200Response +from petstore_api.models.model200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/model200_response.py b/samples/client/petstore/python-asyncio/petstore_api/models/model200_response.py new file mode 100644 index 00000000000..60f9c96a676 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/model200_response.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class Model200Response(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'int', + '_class': 'str' + } + + attribute_map = { + 'name': 'name', + '_class': 'class' + } + + def __init__(self, name=None, _class=None): # noqa: E501 + """Model200Response - a model defined in Swagger""" # noqa: E501 + + self._name = None + self.__class = None + self.discriminator = None + + if name is not None: + self.name = name + if _class is not None: + self._class = _class + + @property + def name(self): + """Gets the name of this Model200Response. # noqa: E501 + + + :return: The name of this Model200Response. # noqa: E501 + :rtype: int + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Model200Response. + + + :param name: The name of this Model200Response. # noqa: E501 + :type: int + """ + + self._name = name + + @property + def _class(self): + """Gets the _class of this Model200Response. # noqa: E501 + + + :return: The _class of this Model200Response. # noqa: E501 + :rtype: str + """ + return self.__class + + @_class.setter + def _class(self, _class): + """Sets the _class of this Model200Response. + + + :param _class: The _class of this Model200Response. # noqa: E501 + :type: str + """ + + self.__class = _class + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Model200Response): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/samples/client/petstore/python-asyncio/test/test_model200_response.py b/samples/client/petstore/python-asyncio/test/test_model200_response.py new file mode 100644 index 00000000000..0a6576d2952 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_model200_response.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.model200_response import Model200Response # noqa: E501 +from petstore_api.rest import ApiException + + +class TestModel200Response(unittest.TestCase): + """Model200Response unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testModel200Response(self): + """Test Model200Response""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.model200_response.Model200Response() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/.swagger-codegen/VERSION b/samples/client/petstore/python-tornado/.swagger-codegen/VERSION index f9f7450d135..855ff9501eb 100644 --- a/samples/client/petstore/python-tornado/.swagger-codegen/VERSION +++ b/samples/client/petstore/python-tornado/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.4.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python-tornado/docs/FakeApi.md b/samples/client/petstore/python-tornado/docs/FakeApi.md index b910ba2b464..1da84500bfe 100644 --- a/samples/client/petstore/python-tornado/docs/FakeApi.md +++ b/samples/client/petstore/python-tornado/docs/FakeApi.md @@ -273,10 +273,10 @@ configuration.password = 'YOUR_PASSWORD' # create an instance of the API class api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration)) -number = 3.4 # float | None +number = 8.14 # float | None double = 1.2 # float | None pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None -byte = 'byte_example' # str | None +byte = 'B' # str | None integer = 56 # int | None (optional) int32 = 56 # int | None (optional) int64 = 789 # int | None (optional) diff --git a/samples/client/petstore/python-tornado/docs/FakeClassnameTags123Api.md b/samples/client/petstore/python-tornado/docs/FakeClassnameTags123Api.md index 2546c09ca4a..8d11d05085a 100644 --- a/samples/client/petstore/python-tornado/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/python-tornado/docs/FakeClassnameTags123Api.md @@ -12,6 +12,8 @@ Method | HTTP request | Description To test class name in snake case +To test class name in snake case + ### Example ```python from __future__ import print_function diff --git a/samples/client/petstore/python-tornado/docs/UserApi.md b/samples/client/petstore/python-tornado/docs/UserApi.md index 969485595ae..e9ec08e24bb 100644 --- a/samples/client/petstore/python-tornado/docs/UserApi.md +++ b/samples/client/petstore/python-tornado/docs/UserApi.md @@ -219,7 +219,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing. +username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing. try: # Get user by user name @@ -233,7 +233,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **str**| The name that needs to be fetched. Use user1 for testing. | + **username** | **str**| The name that needs to be fetched. Use user1 for testing. | ### Return type diff --git a/samples/client/petstore/python-tornado/petstore_api/__init__.py b/samples/client/petstore/python-tornado/petstore_api/__init__.py index c368867dd11..8bf367cc5b8 100644 --- a/samples/client/petstore/python-tornado/petstore_api/__init__.py +++ b/samples/client/petstore/python-tornado/petstore_api/__init__.py @@ -46,7 +46,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model_200_response import Model200Response +from petstore_api.models.model200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python-tornado/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python-tornado/petstore_api/api/fake_classname_tags_123_api.py index 6b6606dc096..230aa5ec4fc 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/fake_classname_tags_123_api.py @@ -36,6 +36,7 @@ def __init__(self, api_client=None): def test_classname(self, body, **kwargs): # noqa: E501 """To test class name in snake case # noqa: E501 + To test class name in snake case # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.test_classname(body, async=True) @@ -57,6 +58,7 @@ def test_classname(self, body, **kwargs): # noqa: E501 def test_classname_with_http_info(self, body, **kwargs): # noqa: E501 """To test class name in snake case # noqa: E501 + To test class name in snake case # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.test_classname_with_http_info(body, async=True) diff --git a/samples/client/petstore/python-tornado/petstore_api/api/user_api.py b/samples/client/petstore/python-tornado/petstore_api/api/user_api.py index 89949844aa1..1de89f28bb0 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/user_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/user_api.py @@ -423,7 +423,7 @@ def get_user_by_name(self, username, **kwargs): # noqa: E501 >>> result = thread.get() :param async bool - :param str username: The name that needs to be fetched. Use user1 for testing. (required) + :param str username: The name that needs to be fetched. Use user1 for testing. (required) :return: User If the method is called asynchronously, returns the request thread. @@ -445,7 +445,7 @@ def get_user_by_name_with_http_info(self, username, **kwargs): # noqa: E501 >>> result = thread.get() :param async bool - :param str username: The name that needs to be fetched. Use user1 for testing. (required) + :param str username: The name that needs to be fetched. Use user1 for testing. (required) :return: User If the method is called asynchronously, returns the request thread. diff --git a/samples/client/petstore/python-tornado/petstore_api/models/__init__.py b/samples/client/petstore/python-tornado/petstore_api/models/__init__.py index 7b339102f9b..c5ae381c40f 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/__init__.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/__init__.py @@ -34,7 +34,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model_200_response import Model200Response +from petstore_api.models.model200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python-tornado/petstore_api/models/model200_response.py b/samples/client/petstore/python-tornado/petstore_api/models/model200_response.py new file mode 100644 index 00000000000..60f9c96a676 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/model200_response.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class Model200Response(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'int', + '_class': 'str' + } + + attribute_map = { + 'name': 'name', + '_class': 'class' + } + + def __init__(self, name=None, _class=None): # noqa: E501 + """Model200Response - a model defined in Swagger""" # noqa: E501 + + self._name = None + self.__class = None + self.discriminator = None + + if name is not None: + self.name = name + if _class is not None: + self._class = _class + + @property + def name(self): + """Gets the name of this Model200Response. # noqa: E501 + + + :return: The name of this Model200Response. # noqa: E501 + :rtype: int + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Model200Response. + + + :param name: The name of this Model200Response. # noqa: E501 + :type: int + """ + + self._name = name + + @property + def _class(self): + """Gets the _class of this Model200Response. # noqa: E501 + + + :return: The _class of this Model200Response. # noqa: E501 + :rtype: str + """ + return self.__class + + @_class.setter + def _class(self, _class): + """Sets the _class of this Model200Response. + + + :param _class: The _class of this Model200Response. # noqa: E501 + :type: str + """ + + self.__class = _class + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Model200Response): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/samples/client/petstore/python-tornado/petstore_api/rest.py b/samples/client/petstore/python-tornado/petstore_api/rest.py index 42c7bea0115..b4f944846d1 100644 --- a/samples/client/petstore/python-tornado/petstore_api/rest.py +++ b/samples/client/petstore/python-tornado/petstore_api/rest.py @@ -92,7 +92,7 @@ def request(self, method, url, query_params=None, headers=None, body=None, "body parameter cannot be used with post_params parameter." ) - request = httpclient.HTTPRequest(url) + request = httpclient.HTTPRequest(url, allow_nonstandard_methods=True) request.ca_certs = self.ca_certs request.client_key = self.client_key request.client_cert = self.client_cert diff --git a/samples/client/petstore/python-tornado/test/test_model200_response.py b/samples/client/petstore/python-tornado/test/test_model200_response.py new file mode 100644 index 00000000000..0a6576d2952 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_model200_response.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.model200_response import Model200Response # noqa: E501 +from petstore_api.rest import ApiException + + +class TestModel200Response(unittest.TestCase): + """Model200Response unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testModel200Response(self): + """Test Model200Response""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.model200_response.Model200Response() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python/.swagger-codegen/VERSION b/samples/client/petstore/python/.swagger-codegen/VERSION index f9f7450d135..855ff9501eb 100644 --- a/samples/client/petstore/python/.swagger-codegen/VERSION +++ b/samples/client/petstore/python/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.4.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python/docs/FakeApi.md b/samples/client/petstore/python/docs/FakeApi.md index b910ba2b464..1da84500bfe 100644 --- a/samples/client/petstore/python/docs/FakeApi.md +++ b/samples/client/petstore/python/docs/FakeApi.md @@ -273,10 +273,10 @@ configuration.password = 'YOUR_PASSWORD' # create an instance of the API class api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration)) -number = 3.4 # float | None +number = 8.14 # float | None double = 1.2 # float | None pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None -byte = 'byte_example' # str | None +byte = 'B' # str | None integer = 56 # int | None (optional) int32 = 56 # int | None (optional) int64 = 789 # int | None (optional) diff --git a/samples/client/petstore/python/docs/FakeClassnameTags123Api.md b/samples/client/petstore/python/docs/FakeClassnameTags123Api.md index 2546c09ca4a..8d11d05085a 100644 --- a/samples/client/petstore/python/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/python/docs/FakeClassnameTags123Api.md @@ -12,6 +12,8 @@ Method | HTTP request | Description To test class name in snake case +To test class name in snake case + ### Example ```python from __future__ import print_function diff --git a/samples/client/petstore/python/docs/UserApi.md b/samples/client/petstore/python/docs/UserApi.md index 969485595ae..e9ec08e24bb 100644 --- a/samples/client/petstore/python/docs/UserApi.md +++ b/samples/client/petstore/python/docs/UserApi.md @@ -219,7 +219,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing. +username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing. try: # Get user by user name @@ -233,7 +233,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **str**| The name that needs to be fetched. Use user1 for testing. | + **username** | **str**| The name that needs to be fetched. Use user1 for testing. | ### Return type diff --git a/samples/client/petstore/python/petstore_api/__init__.py b/samples/client/petstore/python/petstore_api/__init__.py index c368867dd11..8bf367cc5b8 100644 --- a/samples/client/petstore/python/petstore_api/__init__.py +++ b/samples/client/petstore/python/petstore_api/__init__.py @@ -46,7 +46,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model_200_response import Model200Response +from petstore_api.models.model200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py index 6b6606dc096..230aa5ec4fc 100644 --- a/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py @@ -36,6 +36,7 @@ def __init__(self, api_client=None): def test_classname(self, body, **kwargs): # noqa: E501 """To test class name in snake case # noqa: E501 + To test class name in snake case # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.test_classname(body, async=True) @@ -57,6 +58,7 @@ def test_classname(self, body, **kwargs): # noqa: E501 def test_classname_with_http_info(self, body, **kwargs): # noqa: E501 """To test class name in snake case # noqa: E501 + To test class name in snake case # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.test_classname_with_http_info(body, async=True) diff --git a/samples/client/petstore/python/petstore_api/api/user_api.py b/samples/client/petstore/python/petstore_api/api/user_api.py index 89949844aa1..1de89f28bb0 100644 --- a/samples/client/petstore/python/petstore_api/api/user_api.py +++ b/samples/client/petstore/python/petstore_api/api/user_api.py @@ -423,7 +423,7 @@ def get_user_by_name(self, username, **kwargs): # noqa: E501 >>> result = thread.get() :param async bool - :param str username: The name that needs to be fetched. Use user1 for testing. (required) + :param str username: The name that needs to be fetched. Use user1 for testing. (required) :return: User If the method is called asynchronously, returns the request thread. @@ -445,7 +445,7 @@ def get_user_by_name_with_http_info(self, username, **kwargs): # noqa: E501 >>> result = thread.get() :param async bool - :param str username: The name that needs to be fetched. Use user1 for testing. (required) + :param str username: The name that needs to be fetched. Use user1 for testing. (required) :return: User If the method is called asynchronously, returns the request thread. diff --git a/samples/client/petstore/python/petstore_api/models/__init__.py b/samples/client/petstore/python/petstore_api/models/__init__.py index 7b339102f9b..c5ae381c40f 100644 --- a/samples/client/petstore/python/petstore_api/models/__init__.py +++ b/samples/client/petstore/python/petstore_api/models/__init__.py @@ -34,7 +34,7 @@ from petstore_api.models.list import List from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model_200_response import Model200Response +from petstore_api.models.model200_response import Model200Response from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.number_only import NumberOnly diff --git a/samples/client/petstore/python/petstore_api/models/model200_response.py b/samples/client/petstore/python/petstore_api/models/model200_response.py new file mode 100644 index 00000000000..60f9c96a676 --- /dev/null +++ b/samples/client/petstore/python/petstore_api/models/model200_response.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +import pprint +import re # noqa: F401 + +import six + + +class Model200Response(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'int', + '_class': 'str' + } + + attribute_map = { + 'name': 'name', + '_class': 'class' + } + + def __init__(self, name=None, _class=None): # noqa: E501 + """Model200Response - a model defined in Swagger""" # noqa: E501 + + self._name = None + self.__class = None + self.discriminator = None + + if name is not None: + self.name = name + if _class is not None: + self._class = _class + + @property + def name(self): + """Gets the name of this Model200Response. # noqa: E501 + + + :return: The name of this Model200Response. # noqa: E501 + :rtype: int + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Model200Response. + + + :param name: The name of this Model200Response. # noqa: E501 + :type: int + """ + + self._name = name + + @property + def _class(self): + """Gets the _class of this Model200Response. # noqa: E501 + + + :return: The _class of this Model200Response. # noqa: E501 + :rtype: str + """ + return self.__class + + @_class.setter + def _class(self, _class): + """Sets the _class of this Model200Response. + + + :param _class: The _class of this Model200Response. # noqa: E501 + :type: str + """ + + self.__class = _class + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Model200Response): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/samples/client/petstore/python/test/test_model200_response.py b/samples/client/petstore/python/test/test_model200_response.py new file mode 100644 index 00000000000..0a6576d2952 --- /dev/null +++ b/samples/client/petstore/python/test/test_model200_response.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.model200_response import Model200Response # noqa: E501 +from petstore_api.rest import ApiException + + +class TestModel200Response(unittest.TestCase): + """Model200Response unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testModel200Response(self): + """Test Model200Response""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.model200_response.Model200Response() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main()