Skip to content

Commit 4a15832

Browse files
authored
fix: Fix PandasDeserializer tests to more accurately mock response (#1795)
1 parent c1ec0b1 commit 4a15832

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/unit/sagemaker/test_deserializers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def pandas_deserializer():
196196

197197
def test_pandas_deserializer_json(pandas_deserializer):
198198
data = {"col 1": {"row 1": "a", "row 2": "c"}, "col 2": {"row 1": "b", "row 2": "d"}}
199-
stream = io.StringIO(json.dumps(data))
199+
stream = io.BytesIO(json.dumps(data).encode("utf-8"))
200200
result = pandas_deserializer.deserialize(stream, "application/json")
201201
expected = pd.DataFrame(
202202
[["a", "b"], ["c", "d"]], index=["row 1", "row 2"], columns=["col 1", "col 2"]
@@ -205,7 +205,7 @@ def test_pandas_deserializer_json(pandas_deserializer):
205205

206206

207207
def test_pandas_deserializer_csv(pandas_deserializer):
208-
stream = io.StringIO("col 1,col 2\na,b\nc,d")
208+
stream = io.BytesIO(b"col 1,col 2\na,b\nc,d")
209209
result = pandas_deserializer.deserialize(stream, "text/csv")
210210
expected = pd.DataFrame([["a", "b"], ["c", "d"]], columns=["col 1", "col 2"])
211211
assert result.equals(expected)

0 commit comments

Comments
 (0)