@@ -31,7 +31,8 @@ def test_astype_str(self, data):
31
31
# Use `json.dumps(str)` instead of passing `str(obj)` directly to the super method.
32
32
result = pd .Series (data [:5 ]).astype (str )
33
33
expected = pd .Series (
34
- [json .dumps (x , sort_keys = True ) for x in data [:5 ]], dtype = str
34
+ [json .dumps (x , sort_keys = True , separators = ("," , ":" )) for x in data [:5 ]],
35
+ dtype = str ,
35
36
)
36
37
tm .assert_series_equal (result , expected )
37
38
@@ -46,7 +47,7 @@ def test_astype_string(self, data, nullable_string_dtype):
46
47
# Use `json.dumps(str)` instead of passing `str(obj)` directly to the super method.
47
48
result = pd .Series (data [:5 ]).astype (nullable_string_dtype )
48
49
expected = pd .Series (
49
- [json .dumps (x , sort_keys = True ) for x in data [:5 ]],
50
+ [json .dumps (x , sort_keys = True , separators = ( "," , ":" ) ) for x in data [:5 ]],
50
51
dtype = nullable_string_dtype ,
51
52
)
52
53
tm .assert_series_equal (result , expected )
@@ -119,11 +120,14 @@ class TestJSONArrayInterface(base.BaseInterfaceTests):
119
120
def test_array_interface (self , data ):
120
121
result = np .array (data )
121
122
# Use `json.dumps(data[0])` instead of passing `data[0]` directly to the super method.
122
- assert result [0 ] == json .dumps (data [0 ])
123
+ assert result [0 ] == json .dumps (data [0 ], sort_keys = True , separators = ( "," , ":" ) )
123
124
124
125
result = np .array (data , dtype = object )
125
126
# Use `json.dumps(x)` instead of passing `x` directly to the super method.
126
- expected = np .array ([json .dumps (x ) for x in data ], dtype = object )
127
+ expected = np .array (
128
+ [json .dumps (x , sort_keys = True , separators = ("," , ":" )) for x in data ],
129
+ dtype = object ,
130
+ )
127
131
# if expected.ndim > 1:
128
132
# # nested data, explicitly construct as 1D
129
133
# expected = construct_1d_object_array_from_listlike(list(data))
0 commit comments