@@ -78,16 +78,6 @@ def test_equal(self):
7878 self .pet1 .tags = []
7979 self .assertFalse (self .pet1 == self .pet2 )
8080
81- def test_oneof_schema_2_validator (self ):
82- new_color = petstore_api .Color ()
83- array_of_integers = [12 , 34 , 56 ]
84-
85- try :
86- new_color .oneof_schema_2_validator = array_of_integers
87- self .fail (f"Should have failed: { new_color .oneof_schema_2_validator } " )
88- except ValueError as e :
89- self .assertTrue ("List should have at least 4 items after validation, not 3" in str (e ))
90-
9181 def test_oneOf_array_of_integers (self ):
9282 # test new Color
9383 new_color = petstore_api .Color ()
@@ -404,32 +394,14 @@ def test_constraints(self):
404394 hex_color = "#00FF00"
405395
406396 # These should all pass
407- color = petstore_api .Color (oneof_schema_1_validator = rgb )
408- self .assertEqual (rgb , color .oneof_schema_1_validator )
409-
410- color = petstore_api .Color (oneof_schema_2_validator = rgba )
411- self .assertEqual (rgba , color .oneof_schema_2_validator )
412-
413- color = petstore_api .Color (oneof_schema_3_validator = hex_color )
414- self .assertEqual (hex_color , color .oneof_schema_3_validator )
397+ color = petstore_api .Color (rgb )
398+ self .assertEqual (rgb , color .root )
415399
416- try :
417- petstore_api .Color (oneof_schema_1_validator = rgba )
418- self .fail ("invalid validation" )
419- except ValidationError as e :
420- self .assertIn ("List should have at most 3 items after validation, not 4" , str (e ))
400+ color = petstore_api .Color (rgba )
401+ self .assertEqual (rgba , color .root )
421402
422- try :
423- petstore_api .Color (oneof_schema_2_validator = rgb )
424- self .fail ("invalid validation" )
425- except ValidationError as e :
426- self .assertIn ("List should have at least 4 items after validation, not 3" , str (e ))
427-
428- try :
429- petstore_api .Color (oneof_schema_3_validator = "too long string" )
430- self .fail ("invalid validation" )
431- except ValidationError as e :
432- self .assertIn ("String should have at most 7 characters" , str (e ))
403+ color = petstore_api .Color (hex_color )
404+ self .assertEqual (hex_color , color .root )
433405
434406 def test_object_id (self ):
435407 pet_ap = petstore_api .Pet (name = "test name" , photoUrls = ["string" ])
0 commit comments