diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_model.py index ce84e0b035ff..7382980955af 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_model.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_model.py @@ -378,6 +378,28 @@ def test_enum_ref_property(self): self.assertEqual(d5.__fields_set__, {'value', 'str_value'}) self.assertEqual(d5.to_json(), '{"value": 1, "str_value": null}') + def test_enum_string_single_member(self): + enum_test = petstore_api.EnumTest( + enum_string_required="lower", + enum_string_single_member="abc", + enum_integer_single_member=100, + ) + self.assertEqual(enum_test.enum_string_single_member, "abc") + self.assertEqual(enum_test.enum_integer_single_member, 100) + with self.assertRaises(ValueError) as e: + enum_test = petstore_api.EnumTest( + enum_string_required="lower", + enum_string_single_member="ab", + ) + self.assertTrue("must be one of enum values ('abc')" in str(e)) + + with self.assertRaises(ValueError) as e: + enum_test = petstore_api.EnumTest( + enum_string_required="lower", + enum_integer_single_member=10, + ) + self.assertTrue("must be one of enum values (100)" in str(e)) + def test_valdiator(self): # test regular expression a = petstore_api.FormatTest(number=123.45, byte=bytes("string", 'utf-8'), date="2013-09-17", password="testing09876") @@ -414,7 +436,6 @@ def test_object_id(self): pet_ap4 = petstore_api.Pet.from_dict(pet_ap.to_dict()) self.assertNotEqual(id(pet_ap3), id(pet_ap4)) - def test_additional_properties(self): pet_ap = petstore_api.Pet(name="test name", photo_urls=["string"]) pet_ap.id = 1