[python] change Private attr to Class vars (#16687)

* [python] fix TypeError

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update Private model attributes to Class vars

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] rename the List of test cases to ListClass

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update samples

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] rename the List of v1 test cases to ListClass

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] rename the List of v1-aiohttp test cases to ListClass

Signed-off-by: ふぁ <yuki@yuki0311.com>

* update samples

---------

Signed-off-by: ふぁ <yuki@yuki0311.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
ふぁ
2023-10-01 17:52:23 +09:00
committed by GitHub
parent e2f249ba35
commit c6e9a4e1ae
171 changed files with 962 additions and 334 deletions

View File

@@ -173,7 +173,7 @@ class ModelTests(unittest.TestCase):
def test_list(self):
# should throw exception as var_123_list should be string
try:
l3 = petstore_api.List(var_123_list=123)
l3 = petstore_api.ListClass(var_123_list=123)
self.assertTrue(False) # this line shouldn't execute
except ValueError as e:
#error_message = (
@@ -182,13 +182,13 @@ class ModelTests(unittest.TestCase):
# " str type expected (type=type_error.str)\n")
self.assertTrue("str type expected" in str(e))
l = petstore_api.List(var_123_list="bulldog")
l = petstore_api.ListClass(var_123_list="bulldog")
self.assertEqual(l.to_json(), '{"123-list": "bulldog"}')
self.assertEqual(l.to_dict(), {'123-list': 'bulldog'})
l2 = petstore_api.List.from_json(l.to_json())
l2 = petstore_api.ListClass.from_json(l.to_json())
self.assertEqual(l2.var_123_list, 'bulldog')
self.assertTrue(isinstance(l2, petstore_api.List))
self.assertTrue(isinstance(l2, petstore_api.ListClass))
def test_enum_ref_property(self):
# test enum ref property