@@ -351,6 +351,7 @@ def test_client_fixture():
351
351
def test_classes (api ):
352
352
353
353
def thing_eq (ta , tb ):
354
+ ta = model .Thing1 (** ta ) if isinstance (ta , dict ) else ta
354
355
tb = model .Thing1 (** tb ) if isinstance (tb , dict ) else tb
355
356
return ta .tid == tb .tid and ta .name == tb .name and ta .owner == tb .owner
356
357
@@ -364,17 +365,15 @@ def thing_eq(ta, tb):
364
365
# check all combinations
365
366
for path in ["/t0" , "/t1" , "/t2" , "/t3" ]:
366
367
for param in [t0 , t1 , t2 , t3 ]:
367
- for tclass in [model .Thing1 , model .Thing2 , model .Thing3 ]:
368
+ for tclass in [dict , model .Thing1 , model .Thing2 , model .Thing3 ]:
368
369
for method in ["GET" , "POST" ]:
369
370
for mode in ["data" , "json" ]:
370
371
n += 1
371
372
parameter = {mode : {"t" : param }}
372
373
res = api .request (method , path , 200 , ** parameter )
373
- assert res .is_json
374
- json = res .json
375
- assert isinstance (json , dict )
376
- assert thing_eq (tclass (** json ), param )
377
- assert n == 192
374
+ assert res .is_json and isinstance (res .json , dict )
375
+ assert thing_eq (tclass (** res .json ), param )
376
+ assert n == 256
378
377
379
378
# simple types translation
380
379
assert api .get ("/t0" , 200 , json = {"t" : None }).json is None
0 commit comments