fix #11958 [BUG] python generates wrong model name and model file name (#11959)

* fix #11958 [BUG] python generates wrong model name and model file name

Modify AbstractPythonCodegen.toModelName just like AbstractJavaCodegen.toModelName

* add unit test

* update samples and docs
by
./bin/generate-samples.sh
./bin/utils/export_docs_generators.sh

* fix AbstractPythonCodegen#toModelName logic, remove underscore

* update samples and docs
by
./bin/generate-samples.sh
./bin/utils/export_docs_generators.sh
This commit is contained in:
Daniel Qian
2022-04-02 10:43:08 +08:00
committed by GitHub
parent 5d5e753e66
commit 41451ff5ee
34 changed files with 2123 additions and 17 deletions

View File

@@ -0,0 +1,52 @@
# 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.model_200_response import Model_200Response # noqa: E501
from petstore_api.rest import ApiException
class TestModel_200Response(unittest.TestCase):
"""Model_200Response unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional):
"""Test Model_200Response
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.model_200_response.Model_200Response() # noqa: E501
if include_optional :
return Model_200Response(
name = 56,
_class = ''
)
else :
return Model_200Response(
)
def testModel_200Response(self):
"""Test Model_200Response"""
inst_req_only = self.make_instance(include_optional=False)
inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()