Skip to content

Commit d5d92c6

Browse files
author
Kevin Hellemun
committed
Use assertRaises to make code cleaner. (#59)
1 parent f3324e3 commit d5d92c6

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

tests/http/test_bad_request_with_response_id.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from bunq.sdk.exception import BadRequestException
1+
from bunq.sdk.exception import ApiException
22
from bunq.sdk.model.generated.endpoint import UserPerson
33
from tests.bunq_test import BunqSdkTestCase
44

@@ -15,15 +15,12 @@ def test_bad_request_with_response_id(self):
1515
"""
1616
"""
1717

18-
caught_exception = None
19-
20-
try:
18+
with self.assertRaises(ApiException) as caught_exception:
2119
UserPerson.get(
2220
self._get_api_context(),
2321
self._INVALID_USER_PERSON_ID
2422
)
25-
except BadRequestException as exception:
26-
caught_exception = exception
2723

2824
self.assertIsNotNone(caught_exception)
29-
self.assertIsNotNone(caught_exception.response_id)
25+
self.assertIsNotNone(caught_exception.exception)
26+
self.assertIsNotNone(caught_exception.exception.response_id)

0 commit comments

Comments
 (0)