Skip to content

Commit 0f0f5e1

Browse files
committed
update python pydantic v1 tests
1 parent a395ad6 commit 0f0f5e1

File tree

88 files changed

+1154
-1031
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1154
-1031
lines changed

samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_any_type.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,19 @@
33
"""
44
OpenAPI Petstore
55
6-
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
6+
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
77
88
The version of the OpenAPI document: 1.0.0
99
Generated by OpenAPI Generator (https://openapi-generator.tech)
1010
1111
Do not edit the class manually.
12-
"""
12+
""" # noqa: E501
1313

1414

1515
import unittest
1616
import datetime
1717

18-
import petstore_api
1918
from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType # noqa: E501
20-
from petstore_api.rest import ApiException
2119

2220
class TestAdditionalPropertiesAnyType(unittest.TestCase):
2321
"""AdditionalPropertiesAnyType unit test stubs"""
@@ -28,19 +26,19 @@ def setUp(self):
2826
def tearDown(self):
2927
pass
3028

31-
def make_instance(self, include_optional):
29+
def make_instance(self, include_optional) -> AdditionalPropertiesAnyType:
3230
"""Test AdditionalPropertiesAnyType
3331
include_option is a boolean, when False only required
3432
params are included, when True both required and
3533
optional params are included """
3634
# uncomment below to create an instance of `AdditionalPropertiesAnyType`
3735
"""
38-
model = petstore_api.models.additional_properties_any_type.AdditionalPropertiesAnyType() # noqa: E501
39-
if include_optional :
36+
model = AdditionalPropertiesAnyType() # noqa: E501
37+
if include_optional:
4038
return AdditionalPropertiesAnyType(
4139
name = ''
4240
)
43-
else :
41+
else:
4442
return AdditionalPropertiesAnyType(
4543
)
4644
"""

samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_class.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,19 @@
33
"""
44
OpenAPI Petstore
55
6-
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
6+
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
77
88
The version of the OpenAPI document: 1.0.0
99
Generated by OpenAPI Generator (https://openapi-generator.tech)
1010
1111
Do not edit the class manually.
12-
"""
12+
""" # noqa: E501
1313

1414

1515
import unittest
1616
import datetime
1717

18-
import petstore_api
1918
from petstore_api.models.additional_properties_class import AdditionalPropertiesClass # noqa: E501
20-
from petstore_api.rest import ApiException
2119

2220
class TestAdditionalPropertiesClass(unittest.TestCase):
2321
"""AdditionalPropertiesClass unit test stubs"""
@@ -28,26 +26,26 @@ def setUp(self):
2826
def tearDown(self):
2927
pass
3028

31-
def make_instance(self, include_optional):
29+
def make_instance(self, include_optional) -> AdditionalPropertiesClass:
3230
"""Test AdditionalPropertiesClass
3331
include_option is a boolean, when False only required
3432
params are included, when True both required and
3533
optional params are included """
3634
# uncomment below to create an instance of `AdditionalPropertiesClass`
3735
"""
38-
model = petstore_api.models.additional_properties_class.AdditionalPropertiesClass() # noqa: E501
39-
if include_optional :
36+
model = AdditionalPropertiesClass() # noqa: E501
37+
if include_optional:
4038
return AdditionalPropertiesClass(
4139
map_property = {
4240
'key' : ''
43-
},
41+
},
4442
map_of_map_property = {
4543
'key' : {
4644
'key' : ''
4745
}
4846
}
4947
)
50-
else :
48+
else:
5149
return AdditionalPropertiesClass(
5250
)
5351
"""

samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_object.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,19 @@
33
"""
44
OpenAPI Petstore
55
6-
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
6+
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
77
88
The version of the OpenAPI document: 1.0.0
99
Generated by OpenAPI Generator (https://openapi-generator.tech)
1010
1111
Do not edit the class manually.
12-
"""
12+
""" # noqa: E501
1313

1414

1515
import unittest
1616
import datetime
1717

18-
import petstore_api
1918
from petstore_api.models.additional_properties_object import AdditionalPropertiesObject # noqa: E501
20-
from petstore_api.rest import ApiException
2119

2220
class TestAdditionalPropertiesObject(unittest.TestCase):
2321
"""AdditionalPropertiesObject unit test stubs"""
@@ -28,19 +26,19 @@ def setUp(self):
2826
def tearDown(self):
2927
pass
3028

31-
def make_instance(self, include_optional):
29+
def make_instance(self, include_optional) -> AdditionalPropertiesObject:
3230
"""Test AdditionalPropertiesObject
3331
include_option is a boolean, when False only required
3432
params are included, when True both required and
3533
optional params are included """
3634
# uncomment below to create an instance of `AdditionalPropertiesObject`
3735
"""
38-
model = petstore_api.models.additional_properties_object.AdditionalPropertiesObject() # noqa: E501
39-
if include_optional :
36+
model = AdditionalPropertiesObject() # noqa: E501
37+
if include_optional:
4038
return AdditionalPropertiesObject(
4139
name = ''
4240
)
43-
else :
41+
else:
4442
return AdditionalPropertiesObject(
4543
)
4644
"""

samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_with_description_only.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,19 @@
33
"""
44
OpenAPI Petstore
55
6-
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
6+
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
77
88
The version of the OpenAPI document: 1.0.0
99
Generated by OpenAPI Generator (https://openapi-generator.tech)
1010
1111
Do not edit the class manually.
12-
"""
12+
""" # noqa: E501
1313

1414

1515
import unittest
1616
import datetime
1717

18-
import petstore_api
1918
from petstore_api.models.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly # noqa: E501
20-
from petstore_api.rest import ApiException
2119

2220
class TestAdditionalPropertiesWithDescriptionOnly(unittest.TestCase):
2321
"""AdditionalPropertiesWithDescriptionOnly unit test stubs"""
@@ -28,19 +26,19 @@ def setUp(self):
2826
def tearDown(self):
2927
pass
3028

31-
def make_instance(self, include_optional):
29+
def make_instance(self, include_optional) -> AdditionalPropertiesWithDescriptionOnly:
3230
"""Test AdditionalPropertiesWithDescriptionOnly
3331
include_option is a boolean, when False only required
3432
params are included, when True both required and
3533
optional params are included """
3634
# uncomment below to create an instance of `AdditionalPropertiesWithDescriptionOnly`
3735
"""
38-
model = petstore_api.models.additional_properties_with_description_only.AdditionalPropertiesWithDescriptionOnly() # noqa: E501
39-
if include_optional :
36+
model = AdditionalPropertiesWithDescriptionOnly() # noqa: E501
37+
if include_optional:
4038
return AdditionalPropertiesWithDescriptionOnly(
4139
name = ''
4240
)
43-
else :
41+
else:
4442
return AdditionalPropertiesWithDescriptionOnly(
4543
)
4644
"""

samples/openapi3/client/petstore/python-pydantic-v1/test/test_all_of_with_single_ref.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,19 @@
33
"""
44
OpenAPI Petstore
55
6-
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
6+
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
77
88
The version of the OpenAPI document: 1.0.0
9-
Generated by: https://openapi-generator.tech
10-
"""
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
1110
11+
Do not edit the class manually.
12+
""" # noqa: E501
1213

13-
from __future__ import absolute_import
1414

1515
import unittest
1616
import datetime
1717

18-
import petstore_api
1918
from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef # noqa: E501
20-
from petstore_api.rest import ApiException
2119

2220
class TestAllOfWithSingleRef(unittest.TestCase):
2321
"""AllOfWithSingleRef unit test stubs"""
@@ -28,25 +26,28 @@ def setUp(self):
2826
def tearDown(self):
2927
pass
3028

31-
def make_instance(self, include_optional):
29+
def make_instance(self, include_optional) -> AllOfWithSingleRef:
3230
"""Test AllOfWithSingleRef
3331
include_option is a boolean, when False only required
3432
params are included, when True both required and
3533
optional params are included """
36-
# model = petstore_api.models.all_of_with_single_ref.AllOfWithSingleRef() # noqa: E501
37-
if include_optional :
34+
# uncomment below to create an instance of `AllOfWithSingleRef`
35+
"""
36+
model = AllOfWithSingleRef() # noqa: E501
37+
if include_optional:
3838
return AllOfWithSingleRef(
39-
username = '',
40-
single_ref_type = None
39+
username = '',
40+
single_ref_type = 'admin'
4141
)
42-
else :
42+
else:
4343
return AllOfWithSingleRef(
4444
)
45+
"""
4546

4647
def testAllOfWithSingleRef(self):
4748
"""Test AllOfWithSingleRef"""
48-
inst_req_only = self.make_instance(include_optional=False)
49-
inst_req_and_optional = self.make_instance(include_optional=True)
49+
# inst_req_only = self.make_instance(include_optional=False)
50+
# inst_req_and_optional = self.make_instance(include_optional=True)
5051

5152
if __name__ == '__main__':
5253
unittest.main()

samples/openapi3/client/petstore/python-pydantic-v1/test/test_animal.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,19 @@
33
"""
44
OpenAPI Petstore
55
6-
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
6+
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
77
88
The version of the OpenAPI document: 1.0.0
9-
Generated by: https://openapi-generator.tech
10-
"""
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
1110
11+
Do not edit the class manually.
12+
""" # noqa: E501
1213

13-
from __future__ import absolute_import
1414

1515
import unittest
1616
import datetime
1717

18-
import petstore_api
1918
from petstore_api.models.animal import Animal # noqa: E501
20-
from petstore_api.rest import ApiException
2119

2220
class TestAnimal(unittest.TestCase):
2321
"""Animal unit test stubs"""
@@ -28,26 +26,29 @@ def setUp(self):
2826
def tearDown(self):
2927
pass
3028

31-
def make_instance(self, include_optional):
29+
def make_instance(self, include_optional) -> Animal:
3230
"""Test Animal
3331
include_option is a boolean, when False only required
3432
params are included, when True both required and
3533
optional params are included """
36-
# model = petstore_api.models.animal.Animal() # noqa: E501
37-
if include_optional :
34+
# uncomment below to create an instance of `Animal`
35+
"""
36+
model = Animal() # noqa: E501
37+
if include_optional:
3838
return Animal(
39-
class_name = '',
39+
class_name = '',
4040
color = 'red'
4141
)
42-
else :
42+
else:
4343
return Animal(
4444
class_name = '',
4545
)
46+
"""
4647

4748
def testAnimal(self):
4849
"""Test Animal"""
49-
inst_req_only = self.make_instance(include_optional=False)
50-
inst_req_and_optional = self.make_instance(include_optional=True)
50+
# inst_req_only = self.make_instance(include_optional=False)
51+
# inst_req_and_optional = self.make_instance(include_optional=True)
5152

5253
if __name__ == '__main__':
5354
unittest.main()

samples/openapi3/client/petstore/python-pydantic-v1/test/test_another_fake_api.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,30 @@
33
"""
44
OpenAPI Petstore
55
6-
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
6+
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
77
88
The version of the OpenAPI document: 1.0.0
9-
Generated by: https://openapi-generator.tech
10-
"""
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
1110
11+
Do not edit the class manually.
12+
""" # noqa: E501
1213

13-
from __future__ import absolute_import
1414

1515
import unittest
1616

17-
import petstore_api
1817
from petstore_api.api.another_fake_api import AnotherFakeApi # noqa: E501
19-
from petstore_api.rest import ApiException
2018

2119

2220
class TestAnotherFakeApi(unittest.TestCase):
2321
"""AnotherFakeApi unit test stubs"""
2422

25-
def setUp(self):
26-
self.api = petstore_api.api.another_fake_api.AnotherFakeApi() # noqa: E501
23+
def setUp(self) -> None:
24+
self.api = AnotherFakeApi()
2725

28-
def tearDown(self):
29-
pass
26+
def tearDown(self) -> None:
27+
self.api.api_client.close()
3028

31-
def test_call_123_test_special_tags(self):
29+
def test_call_123_test_special_tags(self) -> None:
3230
"""Test case for call_123_test_special_tags
3331
3432
To test special tags # noqa: E501

0 commit comments

Comments
 (0)