Skip to content

Commit cfc0df3

Browse files
committed
fix: linting, mypy, logical issues for jumpstart models
1 parent 6eb825c commit cfc0df3

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

tests/unit/sagemaker/image_uris/test_jumpstart.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import pytest
1919

2020
from tests.unit.sagemaker.jumpstart.utils import get_spec_from_base_spec
21-
from sagemaker.jumpstart.utils import get_jumpstart_content_bucket
2221
from sagemaker.jumpstart import constants as sagemaker_constants
2322

2423

@@ -63,7 +62,7 @@ def test_jumpstart_script_uri(patched_get_model_specs):
6362
sagemaker_constants.JUMPSTART_DEFAULT_REGION_NAME, "pytorch-ic-mobilenet-v2", "*"
6463
)
6564

66-
with pytest.raises(ValueError) as e:
65+
with pytest.raises(ValueError):
6766
image_uris.retrieve(
6867
framework=None,
6968
region="us-west-2",
@@ -73,7 +72,7 @@ def test_jumpstart_script_uri(patched_get_model_specs):
7372
instance_type="ml.p2.xlarge",
7473
)
7574

76-
with pytest.raises(ValueError) as e:
75+
with pytest.raises(ValueError):
7776
image_uris.retrieve(
7877
framework=None,
7978
region="mars-south-1",
@@ -83,7 +82,7 @@ def test_jumpstart_script_uri(patched_get_model_specs):
8382
instance_type="ml.p2.xlarge",
8483
)
8584

86-
with pytest.raises(ValueError) as e:
85+
with pytest.raises(ValueError):
8786
image_uris.retrieve(
8887
framework=None,
8988
region="us-west-2",
@@ -92,7 +91,7 @@ def test_jumpstart_script_uri(patched_get_model_specs):
9291
instance_type="ml.p2.xlarge",
9392
)
9493

95-
with pytest.raises(ValueError) as e:
94+
with pytest.raises(ValueError):
9695
image_uris.retrieve(
9796
framework=None,
9897
region="us-west-2",
@@ -101,7 +100,7 @@ def test_jumpstart_script_uri(patched_get_model_specs):
101100
instance_type="ml.p2.xlarge",
102101
)
103102

104-
with pytest.raises(ValueError) as e:
103+
with pytest.raises(ValueError):
105104
image_uris.retrieve(
106105
region="us-west-2",
107106
framework=None,

tests/unit/sagemaker/test_model_uris.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# language governing permissions and limitations under the License.
1313
from __future__ import absolute_import
1414

15-
from mock.mock import Mock, patch
15+
from mock.mock import patch
1616

1717
from sagemaker import model_uris
1818
from sagemaker.jumpstart import constants as sagemaker_constants
@@ -61,35 +61,35 @@ def test_jumpstart_model_uri(patched_get_model_specs):
6161
sagemaker_constants.JUMPSTART_DEFAULT_REGION_NAME, "pytorch-ic-mobilenet-v2", "*"
6262
)
6363

64-
with pytest.raises(ValueError) as e:
64+
with pytest.raises(ValueError):
6565
model_uris.retrieve(
6666
region="us-west-2",
6767
model_scope="BAD_SCOPE",
6868
model_id="pytorch-ic-mobilenet-v2",
6969
model_version="*",
7070
)
7171

72-
with pytest.raises(ValueError) as e:
72+
with pytest.raises(ValueError):
7373
model_uris.retrieve(
7474
region="mars-south-1",
7575
model_scope="training",
7676
model_id="pytorch-ic-mobilenet-v2",
7777
model_version="*",
7878
)
7979

80-
with pytest.raises(ValueError) as e:
80+
with pytest.raises(ValueError):
8181
model_uris.retrieve(
8282
model_id="pytorch-ic-mobilenet-v2",
8383
model_version="*",
8484
)
8585

86-
with pytest.raises(ValueError) as e:
86+
with pytest.raises(ValueError):
8787
model_uris.retrieve(
8888
model_scope="training",
8989
model_version="*",
9090
)
9191

92-
with pytest.raises(ValueError) as e:
92+
with pytest.raises(ValueError):
9393
model_uris.retrieve(
9494
model_scope="training",
9595
model_id="pytorch-ic-mobilenet-v2",

tests/unit/sagemaker/test_script_uris.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def test_jumpstart_script_uri(patched_get_model_specs):
3333
model_version="*",
3434
)
3535
assert (
36-
uri
37-
== f"s3://{get_jumpstart_content_bucket('us-west-2')}/source-directory-tarballs/pytorch/inference/ic/v1.0.0/sourcedir.tar.gz"
36+
uri == f"s3://{get_jumpstart_content_bucket('us-west-2')}/"
37+
"source-directory-tarballs/pytorch/inference/ic/v1.0.0/sourcedir.tar.gz"
3838
)
3939
patched_get_model_specs.assert_called_once_with("us-west-2", "pytorch-ic-mobilenet-v2", "*")
4040

@@ -47,8 +47,8 @@ def test_jumpstart_script_uri(patched_get_model_specs):
4747
model_version="*",
4848
)
4949
assert (
50-
uri
51-
== f"s3://{get_jumpstart_content_bucket('us-west-2')}/source-directory-tarballs/pytorch/transfer_learning/ic/v1.0.0/sourcedir.tar.gz"
50+
uri == f"s3://{get_jumpstart_content_bucket('us-west-2')}/"
51+
"source-directory-tarballs/pytorch/transfer_learning/ic/v1.0.0/sourcedir.tar.gz"
5252
)
5353
patched_get_model_specs.assert_called_once_with("us-west-2", "pytorch-ic-mobilenet-v2", "*")
5454
patched_get_model_specs.reset_mock()
@@ -62,35 +62,35 @@ def test_jumpstart_script_uri(patched_get_model_specs):
6262
sagemaker_constants.JUMPSTART_DEFAULT_REGION_NAME, "pytorch-ic-mobilenet-v2", "*"
6363
)
6464

65-
with pytest.raises(ValueError) as e:
65+
with pytest.raises(ValueError):
6666
script_uris.retrieve(
6767
region="us-west-2",
6868
script_scope="BAD_SCOPE",
6969
model_id="pytorch-ic-mobilenet-v2",
7070
model_version="*",
7171
)
7272

73-
with pytest.raises(ValueError) as e:
73+
with pytest.raises(ValueError):
7474
script_uris.retrieve(
7575
region="mars-south-1",
7676
script_scope="training",
7777
model_id="pytorch-ic-mobilenet-v2",
7878
model_version="*",
7979
)
8080

81-
with pytest.raises(ValueError) as e:
81+
with pytest.raises(ValueError):
8282
script_uris.retrieve(
8383
model_id="pytorch-ic-mobilenet-v2",
8484
model_version="*",
8585
)
8686

87-
with pytest.raises(ValueError) as e:
87+
with pytest.raises(ValueError):
8888
script_uris.retrieve(
8989
script_scope="training",
9090
model_version="*",
9191
)
9292

93-
with pytest.raises(ValueError) as e:
93+
with pytest.raises(ValueError):
9494
script_uris.retrieve(
9595
script_scope="training",
9696
model_id="pytorch-ic-mobilenet-v2",

0 commit comments

Comments
 (0)