File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88
99def test_api_exception_with_code ():
10- # arrange
1110 error_str = f'error code: { ERROR_CODE } \n message: { ERROR_MESSAGE } '
1211
13- # act
14- with pytest .raises (APIException ) as excinfo :
12+ with pytest .raises (APIException ) as exc_info :
1513 raise APIException (ERROR_CODE , ERROR_MESSAGE )
1614
17- # assert
18- assert excinfo .value .code == ERROR_CODE
19- assert excinfo .value .message == ERROR_MESSAGE
20- assert excinfo .value .__str__ () == error_str
15+ assert exc_info .value .code == ERROR_CODE
16+ assert exc_info .value .message == ERROR_MESSAGE
17+ assert exc_info .value .__str__ () == error_str
2118
2219
2320def test_api_exception_without_code ():
24- # arrange
2521 error_str = f'message: { ERROR_MESSAGE } '
2622
27- # act
28- with pytest .raises (APIException ) as excinfo :
23+ with pytest .raises (APIException ) as exc_info :
2924 raise APIException (None , ERROR_MESSAGE )
3025
31- # assert
32- assert excinfo .value .code is None
33- assert excinfo .value .message == ERROR_MESSAGE
34- assert excinfo .value .__str__ () == error_str
26+ assert exc_info .value .code is None
27+ assert exc_info .value .message == ERROR_MESSAGE
28+ assert exc_info .value .__str__ () == error_str
You can’t perform that action at this time.
0 commit comments