File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -200,14 +200,15 @@ def test_put_compression_blosc(setup_path):
200
200
tm .assert_frame_equal (result , expected )
201
201
202
202
203
- def test_put_mixed_type (setup_path , performance_warning ):
203
+ def test_put_mixed_type (setup_path , performance_warning , using_infer_string ):
204
204
df = DataFrame (
205
205
np .random .default_rng (2 ).standard_normal ((10 , 4 )),
206
206
columns = Index (list ("ABCD" )),
207
207
index = date_range ("2000-01-01" , periods = 10 , freq = "B" ),
208
208
)
209
209
df ["obj1" ] = "foo"
210
- df ["obj2" ] = "bar"
210
+ df ["obj2" ] = [pd .NA ] + 9 * ["bar" ]
211
+ df ["obj2" ] = df ["obj2" ].astype ("string" )
211
212
df ["bool1" ] = df ["A" ] > 0
212
213
df ["bool2" ] = df ["B" ] > 0
213
214
df ["bool3" ] = True
@@ -226,7 +227,11 @@ def test_put_mixed_type(setup_path, performance_warning):
226
227
with tm .assert_produces_warning (performance_warning ):
227
228
store .put ("df" , df )
228
229
229
- expected = df
230
+ expected = df .copy ()
231
+ if using_infer_string :
232
+ expected ["obj2" ] = expected ["obj2" ].astype ("str" )
233
+ else :
234
+ expected ["obj2" ] = expected ["obj2" ].astype ("object" )
230
235
result = store .get ("df" )
231
236
tm .assert_frame_equal (result , expected )
232
237
You can’t perform that action at this time.
0 commit comments