@@ -177,7 +177,7 @@ def test_anyOf_array_of_integers(self):
177
177
except ValueError as e :
178
178
self .assertTrue ("ensure this value is less than or equal to 255" in str (e ))
179
179
180
- # test from_josn
180
+ # test from_json
181
181
json_str = '[12,34,56]'
182
182
p = petstore_api .AnyOfColor .from_json (json_str )
183
183
self .assertEqual (p .actual_instance , [12 , 34 ,56 ])
@@ -187,6 +187,28 @@ def test_anyOf_array_of_integers(self):
187
187
except ValueError as e :
188
188
self .assertTrue ("ensure this value is less than or equal to 255" in str (e ))
189
189
190
+ # test from_json, schema 3
191
+ json_str = '"#123456"'
192
+ p = petstore_api .AnyOfColor .from_json (json_str )
193
+ self .assertIsInstance (p .actual_instance , str )
194
+ self .assertEqual (p .actual_instance , '#123456' )
195
+
196
+ # test to_json, schema 3
197
+ p = petstore_api .AnyOfColor (actual_instance = '#123456' )
198
+ self .assertEqual (p .to_json (), '"#123456"' )
199
+
200
+ # test from_dict, schema 3
201
+ obj = '#123456'
202
+ p = petstore_api .AnyOfColor .from_dict (obj )
203
+ self .assertIsInstance (p .actual_instance , str )
204
+ self .assertEqual (p .actual_instance , '#123456' )
205
+
206
+ # test to_dict, schema 3
207
+ p = petstore_api .AnyOfColor (actual_instance = '#123456' )
208
+ self .assertEqual (p .to_dict (), '#123456' )
209
+ p = petstore_api .AnyOfColor .from_dict (p .to_dict ())
210
+ self .assertEqual (p .actual_instance , '#123456' )
211
+
190
212
def test_oneOf (self ):
191
213
# test new Pig
192
214
bp = petstore_api .BasquePig .from_dict ({"className" : "BasquePig" , "color" : "red" })
@@ -300,6 +322,9 @@ def test_anyOf(self):
300
322
" DanishPig expected dict not int (type=type_error)" )
301
323
self .assertEqual (str (e ), error_message )
302
324
325
+ # test to_dict
326
+ self .assertEqual (p .to_dict (), {'className' : 'BasquePig' , 'color' : 'red' })
327
+
303
328
# test to_json
304
329
self .assertEqual (p .to_json (), '{"className": "BasquePig", "color": "red"}' )
305
330
0 commit comments