File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313np_version_gt2_2 = _nlv >= Version ("2.2.0" )
1414np_version_gt2_3 = _nlv >= Version ("2.3.0" )
1515np_version_gt2_5 = _nlv >= Version ("2.5.0" )
16+ np_version_gt2_6 = _nlv >= Version ("2.6.0.dev0" )
1617is_numpy_dev = _nlv .dev is not None
1718_min_numpy_ver = "1.26.0"
1819
Original file line number Diff line number Diff line change 77import numpy as np
88import pytest
99
10+ from pandas .compat .numpy import np_version_gt2_6
1011import pandas .util ._test_decorators as td
1112
1213import pandas as pd
@@ -527,7 +528,11 @@ def test_dti_union_mixed(self):
527528 # GH#21671
528529 rng = DatetimeIndex ([Timestamp ("2011-01-01" ), pd .NaT ])
529530 rng2 = DatetimeIndex (["2012-01-01" , "2012-01-02" ], tz = "Asia/Tokyo" )
530- result = rng .union (rng2 )
531+ # numpy>=2.6 object-dtype sort compares the tz-naive and tz-aware
532+ # Timestamps directly, so safe_sort fails and union warns
533+ warn = RuntimeWarning if np_version_gt2_6 else None
534+ with tm .assert_produces_warning (warn , match = "sort order is undefined" ):
535+ result = rng .union (rng2 )
531536 expected = Index (
532537 [
533538 Timestamp ("2011-01-01" ),
You can’t perform that action at this time.
0 commit comments