[python] Some cleanup of samples folder (#17127)

* Delete sample folders of discontinued clients

* Remove duplicate python-flask server sample

The python-flask sample actually lives in samples/server/petstore/python-flask.

* Move hand-written test to "tests" folder

Now, "test" only contains generated stubs and all hand-written tests are in "tests".

* Delete left-over files in Python samples

These are not created by the generators (anymore) and not hand-written
for testing.

* Regenerate test file to fix import error
This commit is contained in:
Robert Schweizer
2023-11-19 07:43:34 +01:00
committed by GitHub
parent 1da970b3b1
commit 75ff110449
71 changed files with 47 additions and 5403 deletions

View File

@@ -1,28 +0,0 @@
# List
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**var_123_list** | **str** | | [optional]
## Example
```python
from petstore_api.models.list import List
# TODO update the JSON string below
json = "{}"
# create an instance of List from a JSON string
list_instance = List.from_json(json)
# print the JSON string representation of the object
print List.to_json()
# convert the object into a dict
list_dict = list_instance.to_dict()
# create an instance of List from a dict
list_form_dict = list.from_dict(list_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -1,71 +0,0 @@
# coding: utf-8
"""
OpenAPI 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: \" \\
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from typing import Optional
from pydantic import BaseModel, Field, StrictStr
class List(BaseModel):
"""
List
"""
var_123_list: Optional[StrictStr] = Field(None, alias="123-list")
__properties = ["123-list"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> List:
"""Create an instance of List from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
exclude={
},
exclude_none=True)
return _dict
@classmethod
def from_dict(cls, obj: dict) -> List:
"""Create an instance of List from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return List.parse_obj(obj)
_obj = List.parse_obj({
"var_123_list": obj.get("123-list")
})
return _obj

View File

@@ -1,51 +0,0 @@
# coding: utf-8
"""
OpenAPI 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
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import datetime
import petstore_api
from petstore_api.models.list import List # noqa: E501
from petstore_api.rest import ApiException
class TestList(unittest.TestCase):
"""List unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional):
"""Test List
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = petstore_api.models.list.List() # noqa: E501
if include_optional :
return List(
_123_list = ''
)
else :
return List(
)
def testList(self):
"""Test List"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()