33
44from pandas ._libs .tslibs import Timestamp
55from pandas .compat import PY312
6+ from pandas .errors import Pandas4Warning
67
78import pandas as pd
89from pandas import (
@@ -411,7 +412,9 @@ def test_select_iterator(tmp_path, setup_path):
411412 df2 ["foo" ] = "bar"
412413 store .append ("df2" , df2 )
413414
414- df = concat ([df1 , df2 ], axis = 1 )
415+ msg = "Sorting by default when concatenating all DatetimeIndex is deprecated"
416+ with tm .assert_produces_warning (Pandas4Warning , match = msg ):
417+ df = concat ([df1 , df2 ], axis = 1 )
415418
416419 # full selection
417420 expected = store .select_as_multiple (["df1" , "df2" ], selector = "df1" )
@@ -901,7 +904,9 @@ def test_select_as_multiple(setup_path):
901904 result = store .select_as_multiple (
902905 ["df1" , "df2" ], where = ["A>0" , "B>0" ], selector = "df1"
903906 )
904- expected = concat ([df1 , df2 ], axis = 1 )
907+ msg = "Sorting by default when concatenating all DatetimeIndex is deprecated"
908+ with tm .assert_produces_warning (Pandas4Warning , match = msg ):
909+ expected = concat ([df1 , df2 ], axis = 1 )
905910 expected = expected [(expected .A > 0 ) & (expected .B > 0 )]
906911 tm .assert_frame_equal (result , expected , check_freq = False )
907912 # FIXME: 2021-01-20 this is failing with freq None vs 4B on some builds
@@ -910,7 +915,9 @@ def test_select_as_multiple(setup_path):
910915 result = store .select_as_multiple (
911916 ["df1" , "df2" ], where = "index>df2.index[4]" , selector = "df2"
912917 )
913- expected = concat ([df1 , df2 ], axis = 1 )
918+ msg = "Sorting by default when concatenating all DatetimeIndex is deprecated"
919+ with tm .assert_produces_warning (Pandas4Warning , match = msg ):
920+ expected = concat ([df1 , df2 ], axis = 1 )
914921 expected = expected [5 :]
915922 tm .assert_frame_equal (result , expected )
916923
0 commit comments