Skip to content

Commit

Permalink
Lint Code
Browse files Browse the repository at this point in the history
  • Loading branch information
ziyanli-amazon committed Nov 11, 2023
1 parent dec0412 commit e962a26
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
4 changes: 3 additions & 1 deletion botocore/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,9 @@ def _make_api_call(self, operation_name, api_params):

if http.status_code >= 300:
error_info = parsed_response.get("Error", {})
error_code = error_info.get("QueryErrorCode") or error_info.get("Code")
error_code = error_info.get("QueryErrorCode") or error_info.get(
"Code"
)
error_class = self.exceptions.from_code(error_code)
raise error_class(parsed_response, operation_name)
else:
Expand Down
20 changes: 15 additions & 5 deletions tests/test_sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,22 @@ def test_can_throw_exception_with_correct_error_type(self):
try:
self.client.delete_queue(QueueUrl='foo-nonexistant-queue')
except Exception as e:
assert issubclass(type(e), self.client.exceptions.QueueDoesNotExist), (f"Expected an exception of type "
f"exception.QueueDoesNotExist, "
f"but got {type(e)}")
assert e.response['Error']['Code'] == 'AWS.SimpleQueueService.NonExistentQueue'
assert issubclass(
type(e), self.client.exceptions.QueueDoesNotExist
), (
f"Expected an exception of type "
f"exception.QueueDoesNotExist, "
f"but got {type(e)}"
)
assert (
e.response['Error']['Code']
== 'AWS.SimpleQueueService.NonExistentQueue'
)
assert e.response['ResponseMetadata']['HTTPStatusCode'] == 400
assert e.response['Error']['Message'] == 'The specified queue does not exist.'
assert (
e.response['Error']['Message']
== 'The specified queue does not exist.'
)


if __name__ == '__main__':
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,9 @@ def test_response_with_query_error_for_json_protocol(self):
self.assertEqual(
parsed['Error']['Code'], 'AWS.SimpleQueueService.NonExistentQueue'
)
self.assertEqual(parsed['Error']['QueryErrorCode'], "ValidationException")
self.assertEqual(
parsed['Error']['QueryErrorCode'], "ValidationException"
)
self.assertEqual(parsed['Error']['Type'], 'Sender')

def test_response_with_invalid_query_error_for_json_protocol(self):
Expand Down

0 comments on commit e962a26

Please sign in to comment.