Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fixing JumpStart Tests #4917

Merged
merged 7 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/sagemaker/jumpstart/hub/parser_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@


def camel_to_snake(camel_case_string: str) -> str:
"""Converts PascalCase to snake_case_string using a regex.
"""Converts camelCase to snake_case_string using a regex.

This regex cannot handle whitespace ("PascalString TwoWords")
This regex cannot handle whitespace ("camelString TwoWords")
"""
return re.sub(r"(?<!^)(?=[A-Z])", "_", camel_case_string).lower()

Expand Down
14 changes: 0 additions & 14 deletions tests/integ/sagemaker/jumpstart/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,6 @@ def get_sm_session() -> Session:
return Session(boto_session=boto3.Session(region_name=JUMPSTART_DEFAULT_REGION_NAME))


def get_sm_session_with_override() -> Session:
# [TODO]: Remove service endpoint override before GA
# boto3.set_stream_logger(name='botocore', level=logging.DEBUG)
boto_session = boto3.Session(region_name="us-west-2")
sagemaker = boto3.client(
service_name="sagemaker",
endpoint_url="https://sagemaker.gamma.us-west-2.ml-platform.aws.a2z.com",
)
return Session(
boto_session=boto_session,
sagemaker_client=sagemaker,
)


def get_training_dataset_for_model_and_version(model_id: str, version: str) -> dict:
return TRAINING_DATASET_MODEL_DICT[(model_id, version)]

Expand Down
3 changes: 2 additions & 1 deletion tests/unit/sagemaker/jumpstart/hub/test_parser_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
@pytest.mark.parametrize(
"input_string, expected",
[
("camelCase", "camel_case"),
("PascalCase", "pascal_case"),
("already_snake", "already_snake"),
("", ""),
Expand All @@ -36,7 +37,7 @@
("123StartWithNumber", "123_start_with_number"),
],
)
def test_parse_(input_string, expected):
def test_parse_camelCase(input_string, expected):
assert expected == camel_to_snake(input_string)


Expand Down
Loading