forked from loafle/openapi-generator-original
Add requirments.txt and tox.ini
This commit is contained in:
parent
5af4156c02
commit
ad6b347170
@ -150,6 +150,10 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("setup.mustache", "", "setup.py"));
|
||||
supportingFiles.add(new SupportingFile("tox.mustache", "", "tox.ini"));
|
||||
supportingFiles.add(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt"));
|
||||
supportingFiles.add(new SupportingFile("requirements.mustache", "", "requirements.txt"));
|
||||
|
||||
supportingFiles.add(new SupportingFile("api_client.mustache", swaggerFolder, "api_client.py"));
|
||||
supportingFiles.add(new SupportingFile("rest.mustache", swaggerFolder, "rest.py"));
|
||||
supportingFiles.add(new SupportingFile("configuration.mustache", swaggerFolder, "configuration.py"));
|
||||
|
@ -0,0 +1,5 @@
|
||||
certifi >= 14.05.14
|
||||
six == 1.8.0
|
||||
python_dateutil >= 2.5.3
|
||||
setuptools >= 21.0.0
|
||||
urllib3 >= 1.15.1
|
@ -0,0 +1,5 @@
|
||||
coverage>=4.0.3
|
||||
nose>=1.3.7
|
||||
pluggy>=0.3.1
|
||||
py>=1.4.31
|
||||
randomize>=0.13
|
@ -0,0 +1,9 @@
|
||||
[tox]
|
||||
envlist = py27, py34
|
||||
|
||||
[testenv]
|
||||
deps=-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
|
||||
commands=
|
||||
python setup.py test
|
@ -1,11 +1,11 @@
|
||||
# swagger_client
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: 1.0.0
|
||||
- Package version: 1.0.0
|
||||
- Build date: 2016-05-09T01:08:25.311+01:00
|
||||
- Build date: 2016-05-16T22:16:49.376+01:00
|
||||
- Build package: class io.swagger.codegen.languages.PythonClientCodegen
|
||||
|
||||
## Requirements.
|
||||
@ -66,7 +66,7 @@ date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional)
|
||||
password = 'password_example' # str | None (optional)
|
||||
|
||||
try:
|
||||
# Fake endpoint for testing various parameters
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
api_instance.test_endpoint_parameters(number, double, string, byte, integer=integer, int32=int32, int64=int64, float=float, binary=binary, date=date, date_time=date_time, password=password)
|
||||
except ApiException as e:
|
||||
print "Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e
|
||||
@ -79,7 +79,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters
|
||||
*FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
||||
*PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
@ -105,10 +105,13 @@ Class | Method | HTTP request | Description
|
||||
## Documentation For Models
|
||||
|
||||
- [Animal](docs/Animal.md)
|
||||
- [AnimalFarm](docs/AnimalFarm.md)
|
||||
- [ApiResponse](docs/ApiResponse.md)
|
||||
- [Cat](docs/Cat.md)
|
||||
- [Category](docs/Category.md)
|
||||
- [Dog](docs/Dog.md)
|
||||
- [EnumClass](docs/EnumClass.md)
|
||||
- [EnumTest](docs/EnumTest.md)
|
||||
- [FormatTest](docs/FormatTest.md)
|
||||
- [Model200Response](docs/Model200Response.md)
|
||||
- [ModelReturn](docs/ModelReturn.md)
|
||||
|
@ -4,6 +4,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**class_name** | **str** | |
|
||||
**color** | **str** | | [optional] [default to 'red']
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
9
samples/client/petstore/python/docs/AnimalFarm.md
Normal file
9
samples/client/petstore/python/docs/AnimalFarm.md
Normal file
@ -0,0 +1,9 @@
|
||||
# AnimalFarm
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**class_name** | **str** | |
|
||||
**color** | **str** | | [optional] [default to 'red']
|
||||
**declawed** | **bool** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
@ -4,6 +4,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**class_name** | **str** | |
|
||||
**color** | **str** | | [optional] [default to 'red']
|
||||
**breed** | **str** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
9
samples/client/petstore/python/docs/EnumClass.md
Normal file
9
samples/client/petstore/python/docs/EnumClass.md
Normal file
@ -0,0 +1,9 @@
|
||||
# EnumClass
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
12
samples/client/petstore/python/docs/EnumTest.md
Normal file
12
samples/client/petstore/python/docs/EnumTest.md
Normal file
@ -0,0 +1,12 @@
|
||||
# EnumTest
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**enum_string** | **str** | | [optional]
|
||||
**enum_integer** | **int** | | [optional]
|
||||
**enum_number** | **float** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -4,15 +4,15 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters
|
||||
[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
|
||||
# **test_endpoint_parameters**
|
||||
> test_endpoint_parameters(number, double, string, byte, integer=integer, int32=int32, int64=int64, float=float, binary=binary, date=date, date_time=date_time, password=password)
|
||||
|
||||
Fake endpoint for testing various parameters
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
Fake endpoint for testing various parameters
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
### Example
|
||||
```python
|
||||
@ -37,7 +37,7 @@ date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional)
|
||||
password = 'password_example' # str | None (optional)
|
||||
|
||||
try:
|
||||
# Fake endpoint for testing various parameters
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
api_instance.test_endpoint_parameters(number, double, string, byte, integer=integer, int32=int32, int64=int64, float=float, binary=binary, date=date, date_time=date_time, password=password)
|
||||
except ApiException as e:
|
||||
print "Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e
|
||||
|
@ -6,6 +6,7 @@ Name | Type | Description | Notes
|
||||
**name** | **int** | |
|
||||
**snake_case** | **int** | | [optional]
|
||||
**_property** | **str** | | [optional]
|
||||
**_123_number** | **int** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
5
samples/client/petstore/python/requirements.txt
Normal file
5
samples/client/petstore/python/requirements.txt
Normal file
@ -0,0 +1,5 @@
|
||||
certifi >= 14.05.14
|
||||
six == 1.8.0
|
||||
python_dateutil >= 2.5.3
|
||||
setuptools >= 21.0.0
|
||||
urllib3 >= 1.15.1
|
@ -28,7 +28,7 @@ setup(
|
||||
packages=find_packages(),
|
||||
include_package_data=True,
|
||||
long_description="""\
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
"""
|
||||
)
|
||||
|
||||
|
@ -6,7 +6,7 @@ Home-page: UNKNOWN
|
||||
Author: UNKNOWN
|
||||
Author-email: apiteam@swagger.io
|
||||
License: UNKNOWN
|
||||
Description: This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.
|
||||
Description: This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \
|
||||
|
||||
Keywords: Swagger,Swagger Petstore
|
||||
Platform: UNKNOWN
|
||||
|
@ -2,10 +2,13 @@ from __future__ import absolute_import
|
||||
|
||||
# import models into sdk package
|
||||
from .models.animal import Animal
|
||||
from .models.animal_farm import AnimalFarm
|
||||
from .models.api_response import ApiResponse
|
||||
from .models.cat import Cat
|
||||
from .models.category import Category
|
||||
from .models.dog import Dog
|
||||
from .models.enum_class import EnumClass
|
||||
from .models.enum_test import EnumTest
|
||||
from .models.format_test import FormatTest
|
||||
from .models.model_200_response import Model200Response
|
||||
from .models.model_return import ModelReturn
|
||||
|
@ -48,8 +48,8 @@ class FakeApi(object):
|
||||
|
||||
def test_endpoint_parameters(self, number, double, string, byte, **kwargs):
|
||||
"""
|
||||
Fake endpoint for testing various parameters
|
||||
Fake endpoint for testing various parameters
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
This method makes a synchronous HTTP request by default. To make an
|
||||
asynchronous HTTP request, please define a `callback` function
|
||||
|
@ -2,10 +2,13 @@ from __future__ import absolute_import
|
||||
|
||||
# import models into model package
|
||||
from .animal import Animal
|
||||
from .animal_farm import AnimalFarm
|
||||
from .api_response import ApiResponse
|
||||
from .cat import Cat
|
||||
from .category import Category
|
||||
from .dog import Dog
|
||||
from .enum_class import EnumClass
|
||||
from .enum_test import EnumTest
|
||||
from .format_test import FormatTest
|
||||
from .model_200_response import Model200Response
|
||||
from .model_return import ModelReturn
|
||||
|
@ -38,14 +38,17 @@ class Animal(object):
|
||||
and the value is json key in definition.
|
||||
"""
|
||||
self.swagger_types = {
|
||||
'class_name': 'str'
|
||||
'class_name': 'str',
|
||||
'color': 'str'
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
'class_name': 'className'
|
||||
'class_name': 'className',
|
||||
'color': 'color'
|
||||
}
|
||||
|
||||
self._class_name = None
|
||||
self._color = 'red'
|
||||
|
||||
@property
|
||||
def class_name(self):
|
||||
@ -70,6 +73,29 @@ class Animal(object):
|
||||
|
||||
self._class_name = class_name
|
||||
|
||||
@property
|
||||
def color(self):
|
||||
"""
|
||||
Gets the color of this Animal.
|
||||
|
||||
|
||||
:return: The color of this Animal.
|
||||
:rtype: str
|
||||
"""
|
||||
return self._color
|
||||
|
||||
@color.setter
|
||||
def color(self, color):
|
||||
"""
|
||||
Sets the color of this Animal.
|
||||
|
||||
|
||||
:param color: The color of this Animal.
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._color = color
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
Returns the model properties as a dict
|
||||
|
@ -0,0 +1,98 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Copyright 2016 SmartBear Software
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Ref: https://github.com/swagger-api/swagger-codegen
|
||||
"""
|
||||
|
||||
from pprint import pformat
|
||||
from six import iteritems
|
||||
import re
|
||||
|
||||
|
||||
class AnimalFarm(object):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
def __init__(self):
|
||||
"""
|
||||
AnimalFarm - a model defined in Swagger
|
||||
|
||||
:param dict swaggerTypes: The key is attribute name
|
||||
and the value is attribute type.
|
||||
:param dict attributeMap: The key is attribute name
|
||||
and the value is json key in definition.
|
||||
"""
|
||||
self.swagger_types = {
|
||||
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
|
||||
}
|
||||
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
Returns the model properties as a dict
|
||||
"""
|
||||
result = {}
|
||||
|
||||
for attr, _ in 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 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
|
||||
"""
|
||||
return self.__dict__ == other.__dict__
|
||||
|
||||
def __ne__(self, other):
|
||||
"""
|
||||
Returns true if both objects are not equal
|
||||
"""
|
||||
return not self == other
|
||||
|
@ -39,15 +39,18 @@ class Cat(object):
|
||||
"""
|
||||
self.swagger_types = {
|
||||
'class_name': 'str',
|
||||
'color': 'str',
|
||||
'declawed': 'bool'
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
'class_name': 'className',
|
||||
'color': 'color',
|
||||
'declawed': 'declawed'
|
||||
}
|
||||
|
||||
self._class_name = None
|
||||
self._color = 'red'
|
||||
self._declawed = None
|
||||
|
||||
@property
|
||||
@ -73,6 +76,29 @@ class Cat(object):
|
||||
|
||||
self._class_name = class_name
|
||||
|
||||
@property
|
||||
def color(self):
|
||||
"""
|
||||
Gets the color of this Cat.
|
||||
|
||||
|
||||
:return: The color of this Cat.
|
||||
:rtype: str
|
||||
"""
|
||||
return self._color
|
||||
|
||||
@color.setter
|
||||
def color(self, color):
|
||||
"""
|
||||
Sets the color of this Cat.
|
||||
|
||||
|
||||
:param color: The color of this Cat.
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._color = color
|
||||
|
||||
@property
|
||||
def declawed(self):
|
||||
"""
|
||||
|
@ -39,15 +39,18 @@ class Dog(object):
|
||||
"""
|
||||
self.swagger_types = {
|
||||
'class_name': 'str',
|
||||
'color': 'str',
|
||||
'breed': 'str'
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
'class_name': 'className',
|
||||
'color': 'color',
|
||||
'breed': 'breed'
|
||||
}
|
||||
|
||||
self._class_name = None
|
||||
self._color = 'red'
|
||||
self._breed = None
|
||||
|
||||
@property
|
||||
@ -73,6 +76,29 @@ class Dog(object):
|
||||
|
||||
self._class_name = class_name
|
||||
|
||||
@property
|
||||
def color(self):
|
||||
"""
|
||||
Gets the color of this Dog.
|
||||
|
||||
|
||||
:return: The color of this Dog.
|
||||
:rtype: str
|
||||
"""
|
||||
return self._color
|
||||
|
||||
@color.setter
|
||||
def color(self, color):
|
||||
"""
|
||||
Sets the color of this Dog.
|
||||
|
||||
|
||||
:param color: The color of this Dog.
|
||||
:type: str
|
||||
"""
|
||||
|
||||
self._color = color
|
||||
|
||||
@property
|
||||
def breed(self):
|
||||
"""
|
||||
|
@ -0,0 +1,98 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Copyright 2016 SmartBear Software
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Ref: https://github.com/swagger-api/swagger-codegen
|
||||
"""
|
||||
|
||||
from pprint import pformat
|
||||
from six import iteritems
|
||||
import re
|
||||
|
||||
|
||||
class EnumClass(object):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
def __init__(self):
|
||||
"""
|
||||
EnumClass - a model defined in Swagger
|
||||
|
||||
:param dict swaggerTypes: The key is attribute name
|
||||
and the value is attribute type.
|
||||
:param dict attributeMap: The key is attribute name
|
||||
and the value is json key in definition.
|
||||
"""
|
||||
self.swagger_types = {
|
||||
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
|
||||
}
|
||||
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
Returns the model properties as a dict
|
||||
"""
|
||||
result = {}
|
||||
|
||||
for attr, _ in 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 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
|
||||
"""
|
||||
return self.__dict__ == other.__dict__
|
||||
|
||||
def __ne__(self, other):
|
||||
"""
|
||||
Returns true if both objects are not equal
|
||||
"""
|
||||
return not self == other
|
||||
|
@ -0,0 +1,192 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Copyright 2016 SmartBear Software
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Ref: https://github.com/swagger-api/swagger-codegen
|
||||
"""
|
||||
|
||||
from pprint import pformat
|
||||
from six import iteritems
|
||||
import re
|
||||
|
||||
|
||||
class EnumTest(object):
|
||||
"""
|
||||
NOTE: This class is auto generated by the swagger code generator program.
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
def __init__(self):
|
||||
"""
|
||||
EnumTest - a model defined in Swagger
|
||||
|
||||
:param dict swaggerTypes: The key is attribute name
|
||||
and the value is attribute type.
|
||||
:param dict attributeMap: The key is attribute name
|
||||
and the value is json key in definition.
|
||||
"""
|
||||
self.swagger_types = {
|
||||
'enum_string': 'str',
|
||||
'enum_integer': 'int',
|
||||
'enum_number': 'float'
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
'enum_string': 'enum_string',
|
||||
'enum_integer': 'enum_integer',
|
||||
'enum_number': 'enum_number'
|
||||
}
|
||||
|
||||
self._enum_string = None
|
||||
self._enum_integer = None
|
||||
self._enum_number = None
|
||||
|
||||
@property
|
||||
def enum_string(self):
|
||||
"""
|
||||
Gets the enum_string of this EnumTest.
|
||||
|
||||
|
||||
:return: The enum_string of this EnumTest.
|
||||
:rtype: str
|
||||
"""
|
||||
return self._enum_string
|
||||
|
||||
@enum_string.setter
|
||||
def enum_string(self, enum_string):
|
||||
"""
|
||||
Sets the enum_string of this EnumTest.
|
||||
|
||||
|
||||
:param enum_string: The enum_string of this EnumTest.
|
||||
:type: str
|
||||
"""
|
||||
allowed_values = ["UPPER", "lower"]
|
||||
if enum_string not in allowed_values:
|
||||
raise ValueError(
|
||||
"Invalid value for `enum_string`, must be one of {0}"
|
||||
.format(allowed_values)
|
||||
)
|
||||
|
||||
self._enum_string = enum_string
|
||||
|
||||
@property
|
||||
def enum_integer(self):
|
||||
"""
|
||||
Gets the enum_integer of this EnumTest.
|
||||
|
||||
|
||||
:return: The enum_integer of this EnumTest.
|
||||
:rtype: int
|
||||
"""
|
||||
return self._enum_integer
|
||||
|
||||
@enum_integer.setter
|
||||
def enum_integer(self, enum_integer):
|
||||
"""
|
||||
Sets the enum_integer of this EnumTest.
|
||||
|
||||
|
||||
:param enum_integer: The enum_integer of this EnumTest.
|
||||
:type: int
|
||||
"""
|
||||
allowed_values = ["1", "-1"]
|
||||
if enum_integer not in allowed_values:
|
||||
raise ValueError(
|
||||
"Invalid value for `enum_integer`, must be one of {0}"
|
||||
.format(allowed_values)
|
||||
)
|
||||
|
||||
self._enum_integer = enum_integer
|
||||
|
||||
@property
|
||||
def enum_number(self):
|
||||
"""
|
||||
Gets the enum_number of this EnumTest.
|
||||
|
||||
|
||||
:return: The enum_number of this EnumTest.
|
||||
:rtype: float
|
||||
"""
|
||||
return self._enum_number
|
||||
|
||||
@enum_number.setter
|
||||
def enum_number(self, enum_number):
|
||||
"""
|
||||
Sets the enum_number of this EnumTest.
|
||||
|
||||
|
||||
:param enum_number: The enum_number of this EnumTest.
|
||||
:type: float
|
||||
"""
|
||||
allowed_values = ["1.1", "-1.2"]
|
||||
if enum_number not in allowed_values:
|
||||
raise ValueError(
|
||||
"Invalid value for `enum_number`, must be one of {0}"
|
||||
.format(allowed_values)
|
||||
)
|
||||
|
||||
self._enum_number = enum_number
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
Returns the model properties as a dict
|
||||
"""
|
||||
result = {}
|
||||
|
||||
for attr, _ in 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 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
|
||||
"""
|
||||
return self.__dict__ == other.__dict__
|
||||
|
||||
def __ne__(self, other):
|
||||
"""
|
||||
Returns true if both objects are not equal
|
||||
"""
|
||||
return not self == other
|
||||
|
@ -40,18 +40,21 @@ class Name(object):
|
||||
self.swagger_types = {
|
||||
'name': 'int',
|
||||
'snake_case': 'int',
|
||||
'_property': 'str'
|
||||
'_property': 'str',
|
||||
'_123_number': 'int'
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
'name': 'name',
|
||||
'snake_case': 'snake_case',
|
||||
'_property': 'property'
|
||||
'_property': 'property',
|
||||
'_123_number': '123Number'
|
||||
}
|
||||
|
||||
self._name = None
|
||||
self._snake_case = None
|
||||
self.__property = None
|
||||
self.__123_number = None
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
@ -122,6 +125,29 @@ class Name(object):
|
||||
|
||||
self.__property = _property
|
||||
|
||||
@property
|
||||
def _123_number(self):
|
||||
"""
|
||||
Gets the _123_number of this Name.
|
||||
|
||||
|
||||
:return: The _123_number of this Name.
|
||||
:rtype: int
|
||||
"""
|
||||
return self.__123_number
|
||||
|
||||
@_123_number.setter
|
||||
def _123_number(self, _123_number):
|
||||
"""
|
||||
Sets the _123_number of this Name.
|
||||
|
||||
|
||||
:param _123_number: The _123_number of this Name.
|
||||
:type: int
|
||||
"""
|
||||
|
||||
self.__123_number = _123_number
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
Returns the model properties as a dict
|
||||
|
5
samples/client/petstore/python/test-requirements.txt
Normal file
5
samples/client/petstore/python/test-requirements.txt
Normal file
@ -0,0 +1,5 @@
|
||||
coverage>=4.0.3
|
||||
nose>=1.3.7
|
||||
pluggy>=0.3.1
|
||||
py>=1.4.31
|
||||
randomize>=0.13
|
49
samples/client/petstore/python/test/test_animal_farm.py
Normal file
49
samples/client/petstore/python/test/test_animal_farm.py
Normal file
@ -0,0 +1,49 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Copyright 2016 SmartBear Software
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
ref: https://github.com/swagger-api/swagger-codegen
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from swagger_client.models.animal_farm import AnimalFarm
|
||||
|
||||
|
||||
class TestAnimalFarm(unittest.TestCase):
|
||||
""" AnimalFarm unit test stubs """
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def testAnimalFarm(self):
|
||||
"""
|
||||
Test AnimalFarm
|
||||
"""
|
||||
model = swagger_client.models.animal_farm.AnimalFarm()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
49
samples/client/petstore/python/test/test_enum_class.py
Normal file
49
samples/client/petstore/python/test/test_enum_class.py
Normal file
@ -0,0 +1,49 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Copyright 2016 SmartBear Software
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
ref: https://github.com/swagger-api/swagger-codegen
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from swagger_client.models.enum_class import EnumClass
|
||||
|
||||
|
||||
class TestEnumClass(unittest.TestCase):
|
||||
""" EnumClass unit test stubs """
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def testEnumClass(self):
|
||||
"""
|
||||
Test EnumClass
|
||||
"""
|
||||
model = swagger_client.models.enum_class.EnumClass()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
49
samples/client/petstore/python/test/test_enum_test.py
Normal file
49
samples/client/petstore/python/test/test_enum_test.py
Normal file
@ -0,0 +1,49 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Copyright 2016 SmartBear Software
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
ref: https://github.com/swagger-api/swagger-codegen
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from swagger_client.models.enum_test import EnumTest
|
||||
|
||||
|
||||
class TestEnumTest(unittest.TestCase):
|
||||
""" EnumTest unit test stubs """
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def testEnumTest(self):
|
||||
"""
|
||||
Test EnumTest
|
||||
"""
|
||||
model = swagger_client.models.enum_test.EnumTest()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -2,9 +2,8 @@
|
||||
envlist = py27, py34
|
||||
|
||||
[testenv]
|
||||
deps= -r{toxinidir}/dev-requirements.txt
|
||||
deps=-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
|
||||
commands=
|
||||
nosetests \
|
||||
[]
|
||||
setenv =
|
||||
PYTHONWARNINGS=always::DeprecationWarning
|
||||
python setup.py test
|
||||
|
Loading…
x
Reference in New Issue
Block a user