forked from loafle/openapi-generator-original
[Python] Allow models to have properties of type self (#4888)
* Refactors openapi_types into a staticmethod * Adds a Player model with a self type rpoperty, adds a test to ensure that it is working right
This commit is contained in:
committed by
William Cheng
parent
75508f5ce0
commit
cbc12543a9
@@ -0,0 +1,43 @@
|
||||
# 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 petstore_api
|
||||
|
||||
|
||||
class TestPlayer(unittest.TestCase):
|
||||
"""Player unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def testPlayer(self):
|
||||
"""Test Player"""
|
||||
# we can make a player without an enemy_player property
|
||||
jane = petstore_api.Player(name="Jane")
|
||||
# we can make a player with an enemy_player
|
||||
sally = petstore_api.Player(name="Sally", enemy_player=jane)
|
||||
# we can make a player with an inline enemy_player
|
||||
jim = petstore_api.Player(
|
||||
name="Jim",
|
||||
enemy_player=petstore_api.Player(name="Sam")
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user