William Cheng 3bf8ca7484
[python] Renames python generators (#7965)
* python->python-legacy, python-experimental->python

* test with openjdk8

* test with openjdk11

* comment out rm

* move kotlin tests to circleci

* move kotlin tests

* move tests to circleci

* fix circleci

* rearrange test

* move tests

* use wrapper

Co-authored-by: Justin Black <justin.a.black@gmail.com>
2020-11-18 14:34:00 +08:00

90 lines
2.2 KiB
Python

# 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 sys
import unittest
import petstore_api
try:
from petstore_api.model import category
except ImportError:
category = sys.modules[
'petstore_api.model.category']
try:
from petstore_api.models import tag
except ImportError:
tag = sys.modules[
'petstore_api.model.tag']
from petstore_api.model.pet import Pet
class TestPet(unittest.TestCase):
"""Pet unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def test_to_str(self):
pet = Pet(name="test name", photo_urls=["string"])
pet.id = 1
pet.status = "available"
cate = category.Category()
cate.id = 1
cate.name = "dog"
pet.category = cate
tag1 = tag.Tag()
tag1.id = 1
pet.tags = [tag1]
data = ("{'category': {'id': 1, 'name': 'dog'},\n"
" 'id': 1,\n"
" 'name': 'test name',\n"
" 'photo_urls': ['string'],\n"
" 'status': 'available',\n"
" 'tags': [{'id': 1}]}")
self.assertEqual(data, pet.to_str())
def test_equal(self):
pet1 = Pet(name="test name", photo_urls=["string"])
pet1.id = 1
pet1.status = "available"
cate1 = category.Category()
cate1.id = 1
cate1.name = "dog"
tag1 = tag.Tag()
tag1.id = 1
pet1.tags = [tag1]
pet2 = Pet(name="test name", photo_urls=["string"])
pet2.id = 1
pet2.status = "available"
cate2 = category.Category()
cate2.id = 1
cate2.name = "dog"
tag2 = tag.Tag()
tag2.id = 1
pet2.tags = [tag2]
self.assertTrue(pet1 == pet2)
# reset pet1 tags to empty array so that object comparison returns false
pet1.tags = []
self.assertFalse(pet1 == pet2)
if __name__ == '__main__':
unittest.main()