Skip to content

Commit

Permalink
More formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kddejong committed Oct 6, 2023
1 parent 35d902c commit 91522b7
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 23 deletions.
14 changes: 7 additions & 7 deletions src/rpdk/core/contract/resource_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def assert_write_only_property_does_not_exist(self, resource_model):
assertion_error_message = (
"The model MUST NOT return properties defined as writeOnlyProperties"
" in the resource schema \n Write only properties in resource model :"
f" {error_list} \n Output Resource Model : {{resource_model}} \n"
f" {error_list} \n Output Resource Model : {resource_model} \n"
)
assert not any(error_list), assertion_error_message

Expand Down Expand Up @@ -486,7 +486,7 @@ def compare_model(self, inputs, outputs, path=()):
assertion_error_message = (
f"{assertion_error_message} Value for property {key} in"
f" Request Model({inputs[key]}) and Response"
" Model({outputs[key]}) does not match"
f" Model({outputs[key]}) does not match"
)
assert inputs[key] == outputs[key], assertion_error_message
else:
Expand Down Expand Up @@ -636,8 +636,8 @@ def is_primary_identifier_equal(
)
except KeyError as e:
raise AssertionError(
"The primaryIdentifier returned in every progress event must "
" match the primaryIdentifier passed into the request"
"The primaryIdentifier returned in every progress event must "
"match the primaryIdentifier passed into the request"
) from e

@staticmethod
Expand All @@ -652,8 +652,8 @@ def get_primary_identifier(primary_identifier_path, model):
return pid_list
except KeyError as e:
raise AssertionError(
"The primaryIdentifier returned in every progress event must "
" match the primaryIdentifier passed into the request \n"
"The primaryIdentifier returned in every progress event must "
"match the primaryIdentifier passed into the request \n"
) from e

def _make_payload(
Expand Down Expand Up @@ -751,7 +751,7 @@ def call_and_assert(
if not self.has_required_handlers():
raise ValueError("Create/Read/Delete handlers are required")
if assert_status not in [OperationStatus.SUCCESS, OperationStatus.FAILED]:
raise ValueError("Assert status {assert_status} not supported.")
raise ValueError(f"Assert status {assert_status} not supported.")

status, response = self.call(action, current_model, previous_model, **kwargs)
if assert_status == OperationStatus.SUCCESS:
Expand Down
8 changes: 4 additions & 4 deletions src/rpdk/core/contract/suite/resource/contract_asserts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def response_contains_resource_model_equal_updated_model(
**current_resource_model,
**update_resource_model,
}, (
"All properties specified in the update request MUST be present in the "
" model returned, and they MUST match exactly, with the exception of "
" properties defined as writeOnlyProperties in the resource schema"
"All properties specified in the update request MUST be present in the "
"model returned, and they MUST match exactly, with the exception of "
"properties defined as writeOnlyProperties in the resource schema"
)


Expand All @@ -38,7 +38,7 @@ def response_contains_unchanged_primary_identifier(
current_resource_model,
response["resourceModel"],
), (
"PrimaryIdentifier returned in every progress event must match the"
"PrimaryIdentifier returned in every progress event must match the"
" primaryIdentifier passed into the request"
)

Expand Down
16 changes: 8 additions & 8 deletions src/rpdk/core/contract/suite/resource/handler_commons.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def test_create_success(resource_client, current_resource_model):
@failed_event(
error_code=HandlerErrorCode.AlreadyExists,
msg=(
"A create handler MUST NOT create multiple resources given the same"
" idempotency token"
"A create handler MUST NOT create multiple resources given the same "
"idempotency token"
),
)
def test_create_failure_if_repeat_writeable_id(resource_client, current_resource_model):
Expand Down Expand Up @@ -61,8 +61,8 @@ def test_read_success(resource_client, current_resource_model):
@failed_event(
error_code=HandlerErrorCode.NotFound,
msg=(
"A read handler MUST return FAILED with a NotFound error code if the"
" resource does not exist"
"A read handler MUST return FAILED with a NotFound error code if the "
"resource does not exist"
),
)
def test_read_failure_not_found(
Expand Down Expand Up @@ -144,8 +144,8 @@ def test_update_success(resource_client, update_resource_model, current_resource
@failed_event(
error_code=HandlerErrorCode.NotFound,
msg=(
"An update handler MUST return FAILED with a NotFound error code if the"
" resource did not exist prior to the update request"
"An update handler MUST return FAILED with a NotFound error code if the "
"resource did not exist prior to the update request"
),
)
def test_update_failure_not_found(resource_client, current_resource_model):
Expand All @@ -166,8 +166,8 @@ def test_delete_success(resource_client, current_resource_model):
@failed_event(
error_code=HandlerErrorCode.NotFound,
msg=(
"A delete hander MUST return FAILED with a NotFound error code if the"
" resource did not exist prior to the delete request"
"A delete hander MUST return FAILED with a NotFound error code if the "
"resource did not exist prior to the delete request"
),
)
def test_delete_failure_not_found(resource_client, current_resource_model):
Expand Down
2 changes: 1 addition & 1 deletion src/rpdk/core/contract/suite/resource/handler_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def contract_update_list(updated_resource, resource_client):
assert resource_client.is_primary_identifier_equal(
resource_client.primary_identifier_paths, _created_model, updated_model
), (
"The primaryIdentifier returned must match the primaryIdentifier passed"
"The primaryIdentifier returned must match the primaryIdentifier passed"
" into the request"
)
assert test_model_in_list(resource_client, updated_model), error_test_model_in_list(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def contract_update_without_create(resource_client):
@failed_event(
error_code=HandlerErrorCode.NotFound,
msg=(
"An update handler MUST return FAILED with a NotFound error code if the"
"An update handler MUST return FAILED with a NotFound error code if the"
" resource did not exist prior to the update request"
),
)
Expand All @@ -28,8 +28,7 @@ def test_update_without_create(resource_client):
Action.UPDATE, OperationStatus.FAILED, update_request, create_request
)
assert response["message"], (
"The progress event MUST return an error message when the status is"
" failed"
"The progress event MUST return an error message when the status is" " failed"
)

return _error

0 comments on commit 91522b7

Please sign in to comment.