Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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 sagemaker-core/src/sagemaker/core/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def pascal_to_snake(pascal_str):


def is_not_primitive(obj):
return not isinstance(obj, (int, float, str, bool, datetime.datetime))
return not isinstance(obj, (int, float, str, bool, bytes, datetime.datetime))


def is_not_str_dict(obj):
Expand All @@ -285,7 +285,7 @@ def is_primitive_list(obj):


def is_primitive_class(cls):
return cls in (str, int, bool, float, datetime.datetime)
return cls in (str, int, bool, float, bytes, datetime.datetime)


class Unassigned:
Expand Down
15 changes: 15 additions & 0 deletions sagemaker-core/tests/unit/generated/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,21 @@ def test_serialize_method_nested_shape():
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: There's an extra blank line here (two blank lines between the previous test and this one, resulting in three blank lines total between top-level definitions). PEP 8 specifies two blank lines between top-level definitions. Minor, but CI linting may flag it.



def test_serialize_bytes_returns_bytes():
result = serialize({'body': b'1'})
assert result == {'body': b'1'}
assert serialize(b'hello') == b'hello'


def test_is_not_primitive_with_bytes():
assert is_not_primitive(b'test') is False


def test_is_primitive_class_with_bytes():
assert is_primitive_class(bytes) is True


class TestUnassignedBehavior:
"""Test Unassigned class methods for proper behavior.

Expand Down
Loading