Skip to content

Commit 7dbaa25

Browse files
author
Wenbing Li
authored
Use deep copy for model compare (#766)
* Use deep copy for model compare * Fix isort
1 parent 11618fa commit 7dbaa25

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/rpdk/core/contract/suite/handler_commons.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import copy
12
import logging
23

34
from rpdk.core.contract.interface import Action, HandlerErrorCode, OperationStatus
@@ -149,15 +150,15 @@ def test_delete_failure_not_found(resource_client, current_resource_model):
149150

150151
def test_input_equals_output(resource_client, input_model, output_model):
151152
pruned_input_model = prune_properties_from_model(
152-
input_model.copy(),
153+
copy.deepcopy(input_model),
153154
set(
154155
list(resource_client.read_only_paths)
155156
+ list(resource_client.write_only_paths)
156157
),
157158
)
158159

159160
pruned_output_model = prune_properties_from_model(
160-
output_model.copy(), resource_client.read_only_paths
161+
copy.deepcopy(output_model), resource_client.read_only_paths
161162
)
162163

163164
pruned_output_model = prune_properties_if_not_exist_in_path(

0 commit comments

Comments
 (0)