File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed
Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -48,19 +48,20 @@ def _walk_files():
4848
4949
5050def load_cases (full_path ):
51- all_test_data = json .load (open (full_path ), object_pairs_hook = OrderedDict )
52- for test_data in all_test_data :
53- given = test_data ['given' ]
54- for case in test_data ['cases' ]:
55- if 'result' in case :
56- test_type = 'result'
57- elif 'error' in case :
58- test_type = 'error'
59- elif 'bench' in case :
60- test_type = 'bench'
61- else :
62- raise RuntimeError ("Unknown test type: %s" % json .dumps (case ))
63- yield (given , test_type , case )
51+ with open (full_path , 'r' , encoding = 'utf-8' ) as f :
52+ all_test_data = json .load (f , object_pairs_hook = OrderedDict )
53+ for test_data in all_test_data :
54+ given = test_data ['given' ]
55+ for case in test_data ['cases' ]:
56+ if 'result' in case :
57+ test_type = 'result'
58+ elif 'error' in case :
59+ test_type = 'error'
60+ elif 'bench' in case :
61+ test_type = 'bench'
62+ else :
63+ raise RuntimeError (f"Unknown test type: { json .dumps (case )} " )
64+ yield (given , test_type , case )
6465
6566
6667@pytest .mark .parametrize (
You can’t perform that action at this time.
0 commit comments