File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -81,11 +81,11 @@ def _process_bytes(
8181 content_type : Optional [str ] = StringCodec .ContentType
8282 for elem in data :
8383 converted = elem
84- if not isinstance (elem , str ):
84+ if not isinstance (elem , ( str , bytes ) ):
8585 # There was a non-string element, so we can't determine a content
8686 # type
8787 content_type = None
88- elif use_bytes :
88+ elif isinstance ( elem , str ) and use_bytes :
8989 converted = encode_str (elem )
9090
9191 processed .append (converted )
Original file line number Diff line number Diff line change @@ -32,6 +32,28 @@ def test_can_encode(payload: Any, expected: bool):
3232@pytest .mark .parametrize (
3333 "series, use_bytes, expected" ,
3434 [
35+ (
36+ pd .Series (data = [b"hey" , b"abc" ], name = "foo" ),
37+ True ,
38+ ResponseOutput (
39+ name = "foo" ,
40+ shape = [2 , 1 ],
41+ data = [b"hey" , b"abc" ],
42+ datatype = "BYTES" ,
43+ parameters = Parameters (content_type = StringCodec .ContentType ),
44+ ),
45+ ),
46+ (
47+ pd .Series (data = [b"hey" , b"abc" ], name = "foo" ),
48+ False ,
49+ ResponseOutput (
50+ name = "foo" ,
51+ shape = [2 , 1 ],
52+ data = [b"hey" , b"abc" ],
53+ datatype = "BYTES" ,
54+ parameters = Parameters (content_type = StringCodec .ContentType ),
55+ ),
56+ ),
3557 (
3658 pd .Series (data = ["hey" , "abc" ], name = "foo" ),
3759 True ,
You can’t perform that action at this time.
0 commit comments