Skip to content

Commit

Permalink
flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
bencrabtree committed Aug 13, 2024
1 parent 3fa6c8f commit 915297d
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions tests/unit/sagemaker/jumpstart/hub/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def test_walk_and_apply_json():
"CamelCaseObjectChildTwo": "value2",
},
"IgnoreMyChildren": {"ShouldNotBeTouchedOne": "const1", "ShouldNotBeTouchedTwo": "const2"},
"ShouldNotIgnoreMyChildren": {"NopeNope": "no"}
"ShouldNotIgnoreMyChildren": {"NopeNope": "no"},
}

result = parser_utils.walk_and_apply_json(
Expand All @@ -280,35 +280,26 @@ def test_walk_and_apply_json():
"ShouldNotBeTouchedOne": "const1",
"ShouldNotBeTouchedTwo": "const2",
},
"should_not_ignore_my_children": { "nope_nope": "no"}
"should_not_ignore_my_children": {"nope_nope": "no"},
}


def test_walk_and_apply_json_no_stop():
test_json = {
"CamelCaseKey": "value",
"CamelCaseObjectKey": {
"CamelCaseObjectChildOne": "value1",
"CamelCaseObjectChildTwo": "value2",
},
"CamelCaseObjectListKey": {
"instance.ml.type.xlarge": [
{"ShouldChangeMe": "string"}
]
}
"CamelCaseObjectListKey": {"instance.ml.type.xlarge": [{"ShouldChangeMe": "string"}]},
}

result = parser_utils.walk_and_apply_json(
test_json, parser_utils.camel_to_snake
)
result = parser_utils.walk_and_apply_json(test_json, parser_utils.camel_to_snake)
assert result == {
"camel_case_key": "value",
"camel_case_object_key": {
"camel_case_object_child_one": "value1",
"camel_case_object_child_two": "value2",
},
"camel_case_object_list_key": {
"instance.ml.type.xlarge": [
{ "should_change_me": "string" }
]
},
"camel_case_object_list_key": {"instance.ml.type.xlarge": [{"should_change_me": "string"}]},
}

0 comments on commit 915297d

Please sign in to comment.