Added RuntimeWarning to lib.fast_unique_multiple by ShaharNaveh · Pull Request #33015 · pandas-dev/pandas (original) (raw)

Looks like at L340, it triggers the warning, but only at the AP Linux py37_np_dev

def test_union_sort_other_incomparable():
# https://github.com/pandas-dev/pandas/issues/24959
idx = pd.MultiIndex.from_product([[1, pd.Timestamp("2000")], ["a", "b"]])
# default, sort=None
result = idx.union(idx[:1])
tm.assert_index_equal(result, idx)
# sort=False
result = idx.union(idx[:1], sort=False)
tm.assert_index_equal(result, idx)

@jbrockmendel Does having something like this:

from pandas.compat.numpy import _is_numpy_dev

...

if _is_numpy_dev: with tm.assert_produces_warning(RuntimeWarning): result = idx.union(idx[:1]) else: result = idx.union(idx[:1])

is the correct approach?