|
24 | 24 | def test_js_model_with_optimize_speculative_decoding_config_gated_requests_are_expected( |
25 | 25 | sagemaker_session, |
26 | 26 | ): |
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: |
| 27 | + with ( |
| 28 | + patch.object(Session, "create_model", return_value="mock_model") as mock_create_model, |
| 29 | + patch.object( |
| 30 | + Session, "endpoint_from_production_variants" |
| 31 | + ) as mock_endpoint_from_production_variants, |
| 32 | + ): |
32 | 33 | iam_client = sagemaker_session.boto_session.client("iam") |
33 | 34 | role_arn = iam_client.get_role(RoleName=ROLE_NAME)["Role"]["Arn"] |
34 | 35 |
|
@@ -100,17 +101,18 @@ def test_js_model_with_optimize_speculative_decoding_config_gated_requests_are_e |
100 | 101 | def test_js_model_with_optimize_sharding_and_resource_requirements_requests_are_expected( |
101 | 102 | sagemaker_session, |
102 | 103 | ): |
103 | | - with patch.object( |
104 | | - Session, |
105 | | - "wait_for_optimization_job", |
106 | | - return_value={"OptimizationJobName": "mock_optimization_job"}, |
107 | | - ), patch.object( |
108 | | - Session, "create_model", return_value="mock_model" |
109 | | - ) as mock_create_model, patch.object( |
110 | | - Session, "endpoint_from_production_variants", return_value="mock_endpoint_name" |
111 | | - ) as mock_endpoint_from_production_variants, patch.object( |
112 | | - Session, "create_inference_component" |
113 | | - ) as mock_create_inference_component: |
| 104 | + with ( |
| 105 | + patch.object( |
| 106 | + Session, |
| 107 | + "wait_for_optimization_job", |
| 108 | + return_value={"OptimizationJobName": "mock_optimization_job"}, |
| 109 | + ), |
| 110 | + patch.object(Session, "create_model", return_value="mock_model") as mock_create_model, |
| 111 | + patch.object( |
| 112 | + Session, "endpoint_from_production_variants", return_value="mock_endpoint_name" |
| 113 | + ) as mock_endpoint_from_production_variants, |
| 114 | + patch.object(Session, "create_inference_component") as mock_create_inference_component, |
| 115 | + ): |
114 | 116 | iam_client = sagemaker_session.boto_session.client("iam") |
115 | 117 | role_arn = iam_client.get_role(RoleName=ROLE_NAME)["Role"]["Arn"] |
116 | 118 |
|
@@ -185,15 +187,17 @@ def test_js_model_with_optimize_sharding_and_resource_requirements_requests_are_ |
185 | 187 | def test_js_model_with_optimize_quantization_on_pre_optimized_model_requests_are_expected( |
186 | 188 | sagemaker_session, |
187 | 189 | ): |
188 | | - with patch.object( |
189 | | - Session, |
190 | | - "wait_for_optimization_job", |
191 | | - return_value={"OptimizationJobName": "mock_optimization_job"}, |
192 | | - ), patch.object( |
193 | | - Session, "create_model", return_value="mock_model" |
194 | | - ) as mock_create_model, patch.object( |
195 | | - Session, "endpoint_from_production_variants", return_value="mock_endpoint_name" |
196 | | - ) as mock_endpoint_from_production_variants: |
| 190 | + with ( |
| 191 | + patch.object( |
| 192 | + Session, |
| 193 | + "wait_for_optimization_job", |
| 194 | + return_value={"OptimizationJobName": "mock_optimization_job"}, |
| 195 | + ), |
| 196 | + patch.object(Session, "create_model", return_value="mock_model") as mock_create_model, |
| 197 | + patch.object( |
| 198 | + Session, "endpoint_from_production_variants", return_value="mock_endpoint_name" |
| 199 | + ) as mock_endpoint_from_production_variants, |
| 200 | + ): |
197 | 201 | iam_client = sagemaker_session.boto_session.client("iam") |
198 | 202 | role_arn = iam_client.get_role(RoleName=ROLE_NAME)["Role"]["Arn"] |
199 | 203 |
|
|
0 commit comments