mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-20 11:07:12 +00:00
add support for union of strictfloat and strictint (#15124)
This commit is contained in:
@@ -59,6 +59,17 @@ class TestManual(unittest.TestCase):
|
||||
api_response = api_instance.test_binary_gif()
|
||||
self.assertEqual((base64.b64encode(api_response)).decode("utf-8"), "R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==")
|
||||
|
||||
def testNumberPropertiesOnly(self):
|
||||
n = openapi_client.NumberPropertiesOnly.from_json('{"number": 123, "float": 456, "double": 34}')
|
||||
self.assertEqual(n.number, 123)
|
||||
self.assertEqual(n.float, 456)
|
||||
self.assertEqual(n.double, 34)
|
||||
|
||||
n = openapi_client.NumberPropertiesOnly.from_json('{"number": 123.1, "float": 456.2, "double": 34.3}')
|
||||
self.assertEqual(n.number, 123.1)
|
||||
self.assertEqual(n.float, 456.2)
|
||||
self.assertEqual(n.double, 34.3)
|
||||
|
||||
class EchoServerResponseParser():
|
||||
def __init__(self, http_response):
|
||||
if http_response is None:
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.models.number_properties_only import NumberPropertiesOnly # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
class TestNumberPropertiesOnly(unittest.TestCase):
|
||||
"""NumberPropertiesOnly unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test NumberPropertiesOnly
|
||||
include_option is a boolean, when False only required
|
||||
params are included, when True both required and
|
||||
optional params are included """
|
||||
# uncomment below to create an instance of `NumberPropertiesOnly`
|
||||
"""
|
||||
model = openapi_client.models.number_properties_only.NumberPropertiesOnly() # noqa: E501
|
||||
if include_optional :
|
||||
return NumberPropertiesOnly(
|
||||
number = 1.337,
|
||||
float = 1.337,
|
||||
double = ''
|
||||
)
|
||||
else :
|
||||
return NumberPropertiesOnly(
|
||||
)
|
||||
"""
|
||||
|
||||
def testNumberPropertiesOnly(self):
|
||||
"""Test NumberPropertiesOnly"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user