|
24 | 24 | def test_js_model_with_optimize_speculative_decoding_config_gated_requests_are_expected( |
25 | 25 | sagemaker_session, |
26 | 26 | ): |
27 | | - with ( |
28 | | - patch.object( |
29 | | - Session, "create_model", return_value="mock_model" |
30 | | - ) as mock_create_model, # noqa: E999 |
31 | | - patch.object( |
32 | | - Session, "endpoint_from_production_variants" |
33 | | - ) as mock_endpoint_from_production_variants, |
34 | | - ): |
| 27 | + with patch.object( |
| 28 | + Session, "create_model", return_value="mock_model" |
| 29 | + ) as mock_create_model, patch.object( |
| 30 | + Session, "endpoint_from_production_variants" |
| 31 | + ) as mock_endpoint_from_production_variants: |
35 | 32 | iam_client = sagemaker_session.boto_session.client("iam") |
36 | 33 | role_arn = iam_client.get_role(RoleName=ROLE_NAME)["Role"]["Arn"] |
37 | 34 |
|
@@ -99,18 +96,17 @@ def test_js_model_with_optimize_speculative_decoding_config_gated_requests_are_e |
99 | 96 | def test_js_model_with_optimize_sharding_and_resource_requirements_requests_are_expected( |
100 | 97 | sagemaker_session, |
101 | 98 | ): |
102 | | - with ( |
103 | | - patch.object( |
104 | | - Session, |
105 | | - "wait_for_optimization_job", |
106 | | - return_value={"OptimizationJobName": "mock_optimization_job"}, |
107 | | - ), |
108 | | - patch.object(Session, "create_model", return_value="mock_model") as mock_create_model, |
109 | | - patch.object( |
110 | | - Session, "endpoint_from_production_variants", return_value="mock_endpoint_name" |
111 | | - ) as mock_endpoint_from_production_variants, |
112 | | - patch.object(Session, "create_inference_component") as mock_create_inference_component, |
113 | | - ): |
| 99 | + with patch.object( |
| 100 | + Session, |
| 101 | + "wait_for_optimization_job", |
| 102 | + return_value={"OptimizationJobName": "mock_optimization_job"}, |
| 103 | + ), patch.object( |
| 104 | + Session, "create_model", return_value="mock_model" |
| 105 | + ) as mock_create_model, patch.object( |
| 106 | + Session, "endpoint_from_production_variants", return_value="mock_endpoint_name" |
| 107 | + ) as mock_endpoint_from_production_variants, patch.object( |
| 108 | + Session, "create_inference_component" |
| 109 | + ) as mock_create_inference_component: |
114 | 110 | iam_client = sagemaker_session.boto_session.client("iam") |
115 | 111 | role_arn = iam_client.get_role(RoleName=ROLE_NAME)["Role"]["Arn"] |
116 | 112 |
|
@@ -178,17 +174,15 @@ def test_js_model_with_optimize_sharding_and_resource_requirements_requests_are_ |
178 | 174 | def test_js_model_with_optimize_quantization_on_pre_optimized_model_requests_are_expected( |
179 | 175 | sagemaker_session, |
180 | 176 | ): |
181 | | - with ( |
182 | | - patch.object( |
183 | | - Session, |
184 | | - "wait_for_optimization_job", |
185 | | - return_value={"OptimizationJobName": "mock_optimization_job"}, |
186 | | - ), |
187 | | - patch.object(Session, "create_model", return_value="mock_model") as mock_create_model, |
188 | | - patch.object( |
189 | | - Session, "endpoint_from_production_variants", return_value="mock_endpoint_name" |
190 | | - ) as mock_endpoint_from_production_variants, |
191 | | - ): |
| 177 | + with patch.object( |
| 178 | + Session, |
| 179 | + "wait_for_optimization_job", |
| 180 | + return_value={"OptimizationJobName": "mock_optimization_job"}, |
| 181 | + ), patch.object( |
| 182 | + Session, "create_model", return_value="mock_model" |
| 183 | + ) as mock_create_model, patch.object( |
| 184 | + Session, "endpoint_from_production_variants", return_value="mock_endpoint_name" |
| 185 | + ) as mock_endpoint_from_production_variants: |
192 | 186 | iam_client = sagemaker_session.boto_session.client("iam") |
193 | 187 | role_arn = iam_client.get_role(RoleName=ROLE_NAME)["Role"]["Arn"] |
194 | 188 |
|
|
0 commit comments