Closed
Description
this is passing on master, but not on 1.2.1
2021-01-16T02:31:05.2414654Z =================================== FAILURES ===================================
2021-01-16T02:31:05.2415844Z _ TestComparison.test_index_series_compat[eq-IntervalIndex-array-assert_numpy_array_equal] _
2021-01-16T02:31:05.2416708Z [gw1] linux -- Python 3.8.5 /home/vsts/miniconda3/envs/pandas-dev/bin/python
2021-01-16T02:31:05.2417059Z
2021-01-16T02:31:05.2417505Z self = <pandas.tests.arithmetic.test_interval.TestComparison object at 0x7f7984759fa0>
2021-01-16T02:31:05.2420975Z op = <built-in function eq>
2021-01-16T02:31:05.2447033Z constructor = <class 'pandas.core.indexes.interval.IntervalIndex'>
2021-01-16T02:31:05.2461011Z expected_type = <built-in function array>
2021-01-16T02:31:05.2461472Z assert_func = <function assert_numpy_array_equal at 0x7f79d19fb280>
2021-01-16T02:31:05.2461911Z
2021-01-16T02:31:05.2462190Z @pytest.mark.parametrize(
2021-01-16T02:31:05.2462598Z "constructor, expected_type, assert_func",
2021-01-16T02:31:05.2462923Z [
2021-01-16T02:31:05.2463268Z (IntervalIndex, np.array, tm.assert_numpy_array_equal),
2021-01-16T02:31:05.2463755Z (Series, Series, tm.assert_series_equal),
2021-01-16T02:31:05.2464080Z ],
2021-01-16T02:31:05.2464384Z )
2021-01-16T02:31:05.2464794Z def test_index_series_compat(self, op, constructor, expected_type, assert_func):
2021-01-16T02:31:05.2465386Z # IntervalIndex/Series that rely on IntervalArray for comparisons
2021-01-16T02:31:05.2465772Z breaks = range(4)
2021-01-16T02:31:05.2466225Z index = constructor(IntervalIndex.from_breaks(breaks))
2021-01-16T02:31:05.2466569Z
2021-01-16T02:31:05.2466845Z # scalar comparisons
2021-01-16T02:31:05.2467209Z other = index[0]
2021-01-16T02:31:05.2467523Z result = op(index, other)
2021-01-16T02:31:05.2467991Z expected = expected_type(self.elementwise_comparison(op, index, other))
2021-01-16T02:31:05.2468402Z assert_func(result, expected)
2021-01-16T02:31:05.2468765Z
2021-01-16T02:31:05.2469036Z other = breaks[0]
2021-01-16T02:31:05.2469532Z result = op(index, other)
2021-01-16T02:31:05.2469988Z expected = expected_type(self.elementwise_comparison(op, index, other))
2021-01-16T02:31:05.2470394Z assert_func(result, expected)
2021-01-16T02:31:05.2470739Z
2021-01-16T02:31:05.2471260Z # list-like comparisons
2021-01-16T02:31:05.2471642Z other = IntervalArray.from_breaks(breaks)
2021-01-16T02:31:05.2472056Z result = op(index, other)
2021-01-16T02:31:05.2472452Z expected = expected_type(self.elementwise_comparison(op, index, other))
2021-01-16T02:31:05.2472923Z assert_func(result, expected)
2021-01-16T02:31:05.2473207Z
2021-01-16T02:31:05.2473879Z other = [index[0], breaks[0], "foo"]
2021-01-16T02:31:05.2474269Z result = op(index, other)
2021-01-16T02:31:05.2474668Z expected = expected_type(self.elementwise_comparison(op, index, other))
2021-01-16T02:31:05.2475135Z > assert_func(result, expected)
2021-01-16T02:31:05.2475399Z
2021-01-16T02:31:05.2475764Z pandas/tests/arithmetic/test_interval.py:287:
2021-01-16T02:31:05.2476208Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-01-16T02:31:05.2476557Z
2021-01-16T02:31:05.2476986Z left = array([False, False, False]), right = array([ True, False, False])
2021-01-16T02:31:05.2477357Z err_msg = None
2021-01-16T02:31:05.2477641Z
2021-01-16T02:31:05.2477946Z def _raise(left, right, err_msg):
2021-01-16T02:31:05.2478307Z if err_msg is None:
2021-01-16T02:31:05.2478738Z if left.shape != right.shape:
2021-01-16T02:31:05.2479107Z raise_assert_detail(
2021-01-16T02:31:05.2479563Z obj, f"{obj} shapes are different", left.shape, right.shape
2021-01-16T02:31:05.2479942Z )
2021-01-16T02:31:05.2480247Z
2021-01-16T02:31:05.2480506Z diff = 0
2021-01-16T02:31:05.2480879Z for left_arr, right_arr in zip(left, right):
2021-01-16T02:31:05.2481340Z # count up differences
2021-01-16T02:31:05.2481806Z if not array_equivalent(left_arr, right_arr, strict_nan=strict_nan):
2021-01-16T02:31:05.2482323Z diff += 1
2021-01-16T02:31:05.2482597Z
2021-01-16T02:31:05.2482891Z diff = diff * 100.0 / left.size
2021-01-16T02:31:05.2483349Z msg = f"{obj} values are different ({np.round(diff, 5)} %)"
2021-01-16T02:31:05.2483814Z > raise_assert_detail(obj, msg, left, right, index_values=index_values)
2021-01-16T02:31:05.2484450Z E AssertionError: numpy array are different
2021-01-16T02:31:05.2484795Z E
2021-01-16T02:31:05.2485284Z E numpy array values are different (33.33333 %)
2021-01-16T02:31:05.2485649Z E [left]: [False, False, False]
2021-01-16T02:31:05.2486175Z E [right]: [True, False, False]
2021-01-16T02:31:05.2486482Z
2021-01-16T02:31:05.2486757Z pandas/_testing.py:1159: AssertionError
2021-01-16T02:31:05.2487496Z _ TestComparison.test_index_series_compat[eq-Series-Series-assert_series_equal] _
2021-01-16T02:31:05.2488191Z [gw1] linux -- Python 3.8.5 /home/vsts/miniconda3/envs/pandas-dev/bin/python
2021-01-16T02:31:05.2488567Z
2021-01-16T02:31:05.2488904Z self = <pandas.tests.arithmetic.test_interval.TestComparison object at 0x7f79840c7730>
2021-01-16T02:31:05.2489563Z op = <built-in function eq>, constructor = <class 'pandas.core.series.Series'>
2021-01-16T02:31:05.2490223Z expected_type = <class 'pandas.core.series.Series'>
2021-01-16T02:31:05.2490622Z assert_func = <function assert_series_equal at 0x7f79d19fb3a0>
2021-01-16T02:31:05.2490958Z
2021-01-16T02:31:05.2491206Z @pytest.mark.parametrize(
2021-01-16T02:31:05.2491526Z "constructor, expected_type, assert_func",
2021-01-16T02:31:05.2491885Z [
2021-01-16T02:31:05.2492201Z (IntervalIndex, np.array, tm.assert_numpy_array_equal),
2021-01-16T02:31:05.2492660Z (Series, Series, tm.assert_series_equal),
2021-01-16T02:31:05.2492958Z ],
2021-01-16T02:31:05.2493334Z )
2021-01-16T02:31:05.2493713Z def test_index_series_compat(self, op, constructor, expected_type, assert_func):
2021-01-16T02:31:05.2494196Z # IntervalIndex/Series that rely on IntervalArray for comparisons
2021-01-16T02:31:05.2494601Z breaks = range(4)
2021-01-16T02:31:05.2515866Z index = constructor(IntervalIndex.from_breaks(breaks))
2021-01-16T02:31:05.2516454Z
2021-01-16T02:31:05.2516755Z # scalar comparisons
2021-01-16T02:31:05.2517121Z other = index[0]
2021-01-16T02:31:05.2517451Z result = op(index, other)
2021-01-16T02:31:05.2518053Z expected = expected_type(self.elementwise_comparison(op, index, other))
2021-01-16T02:31:05.2518530Z assert_func(result, expected)
2021-01-16T02:31:05.2518818Z
2021-01-16T02:31:05.2519159Z other = breaks[0]
2021-01-16T02:31:05.2519477Z result = op(index, other)
2021-01-16T02:31:05.2519960Z expected = expected_type(self.elementwise_comparison(op, index, other))
2021-01-16T02:31:05.2520457Z assert_func(result, expected)
2021-01-16T02:31:05.2520751Z
2021-01-16T02:31:05.2521443Z # list-like comparisons
2021-01-16T02:31:05.2521826Z other = IntervalArray.from_breaks(breaks)
2021-01-16T02:31:05.2522244Z result = op(index, other)
2021-01-16T02:31:05.2522645Z expected = expected_type(self.elementwise_comparison(op, index, other))
2021-01-16T02:31:05.2523109Z assert_func(result, expected)
2021-01-16T02:31:05.2523399Z
2021-01-16T02:31:05.2523698Z other = [index[0], breaks[0], "foo"]
2021-01-16T02:31:05.2524100Z result = op(index, other)
2021-01-16T02:31:05.2524497Z expected = expected_type(self.elementwise_comparison(op, index, other))
2021-01-16T02:31:05.2524958Z > assert_func(result, expected)
2021-01-16T02:31:05.2525215Z
2021-01-16T02:31:05.2525528Z pandas/tests/arithmetic/test_interval.py:287:
2021-01-16T02:31:05.2526028Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-01-16T02:31:05.2526680Z pandas/_libs/testing.pyx:46: in pandas._libs.testing.assert_almost_equal
2021-01-16T02:31:05.2527142Z cpdef assert_almost_equal(a, b,
2021-01-16T02:31:05.2527546Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-01-16T02:31:05.2527956Z
2021-01-16T02:31:05.2528320Z > raise_assert_detail(obj, msg, lobj, robj, index_values=index_values)
2021-01-16T02:31:05.2528734Z E AssertionError: Series are different
2021-01-16T02:31:05.2529231Z E
2021-01-16T02:31:05.2529534Z E Series values are different (33.33333 %)
2021-01-16T02:31:05.2529923Z E [index]: [0, 1, 2]
2021-01-16T02:31:05.2530368Z E [left]: [False, False, False]
2021-01-16T02:31:05.2530715Z E [right]: [True, False, False]
2021-01-16T02:31:05.2531028Z
2021-01-16T02:31:05.2531331Z pandas/_libs/testing.pyx:161: AssertionError
2021-01-16T02:31:05.2532134Z _ TestComparison.test_index_series_compat[ne-IntervalIndex-array-assert_numpy_array_equal] _
2021-01-16T02:31:05.2532992Z [gw1] linux -- Python 3.8.5 /home/vsts/miniconda3/envs/pandas-dev/bin/python
2021-01-16T02:31:05.2533317Z
2021-01-16T02:31:05.2533705Z self = <pandas.tests.arithmetic.test_interval.TestComparison object at 0x7f7984d5c5e0>
2021-01-16T02:31:05.2534243Z op = <built-in function ne>
2021-01-16T02:31:05.2534860Z constructor = <class 'pandas.core.indexes.interval.IntervalIndex'>
2021-01-16T02:31:05.2535420Z expected_type = <built-in function array>
2021-01-16T02:31:05.2535864Z assert_func = <function assert_numpy_array_equal at 0x7f79d19fb280>
2021-01-16T02:31:05.2536160Z
2021-01-16T02:31:05.2536407Z @pytest.mark.parametrize(
2021-01-16T02:31:05.2536807Z "constructor, expected_type, assert_func",
2021-01-16T02:31:05.2537102Z [
2021-01-16T02:31:05.2537468Z (IntervalIndex, np.array, tm.assert_numpy_array_equal),
2021-01-16T02:31:05.2537854Z (Series, Series, tm.assert_series_equal),
2021-01-16T02:31:05.2538200Z ],
2021-01-16T02:31:05.2538511Z )
2021-01-16T02:31:05.2538887Z def test_index_series_compat(self, op, constructor, expected_type, assert_func):
2021-01-16T02:31:05.2606624Z # IntervalIndex/Series that rely on IntervalArray for comparisons
2021-01-16T02:31:05.2607151Z breaks = range(4)
2021-01-16T02:31:05.2687364Z index = constructor(IntervalIndex.from_breaks(breaks))
2021-01-16T02:31:05.2687833Z
2021-01-16T02:31:05.2688104Z # scalar comparisons
2021-01-16T02:31:05.2688414Z other = index[0]
2021-01-16T02:31:05.2688719Z result = op(index, other)
2021-01-16T02:31:05.2689117Z expected = expected_type(self.elementwise_comparison(op, index, other))
2021-01-16T02:31:05.2689504Z assert_func(result, expected)
2021-01-16T02:31:05.2689783Z
2021-01-16T02:31:05.2690033Z other = breaks[0]
2021-01-16T02:31:05.2690325Z result = op(index, other)
2021-01-16T02:31:05.2690722Z expected = expected_type(self.elementwise_comparison(op, index, other))
2021-01-16T02:31:05.2691115Z assert_func(result, expected)
2021-01-16T02:31:05.2691394Z
2021-01-16T02:31:05.2692145Z # list-like comparisons
2021-01-16T02:31:05.2692512Z other = IntervalArray.from_breaks(breaks)
2021-01-16T02:31:05.2692846Z result = op(index, other)
2021-01-16T02:31:05.2693221Z expected = expected_type(self.elementwise_comparison(op, index, other))
2021-01-16T02:31:05.2693623Z assert_func(result, expected)
2021-01-16T02:31:05.2693887Z
2021-01-16T02:31:05.2694180Z other = [index[0], breaks[0], "foo"]
2021-01-16T02:31:05.2694546Z result = op(index, other)
2021-01-16T02:31:05.2694934Z expected = expected_type(self.elementwise_comparison(op, index, other))
2021-01-16T02:31:05.2695322Z > assert_func(result, expected)
2021-01-16T02:31:05.2695556Z
2021-01-16T02:31:05.2695863Z pandas/tests/arithmetic/test_interval.py:287:
2021-01-16T02:31:05.2696276Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2021-01-16T02:31:05.2696602Z
2021-01-16T02:31:05.2696918Z left = array([ True, True, True]), right = array([False, True, True])
2021-01-16T02:31:05.2697265Z err_msg = None
2021-01-16T02:31:05.2697480Z
2021-01-16T02:31:05.2697762Z def _raise(left, right, err_msg):
2021-01-16T02:31:05.2698114Z if err_msg is None:
2021-01-16T02:31:05.2698459Z if left.shape != right.shape:
2021-01-16T02:31:05.2698803Z raise_assert_detail(
2021-01-16T02:31:05.2699198Z obj, f"{obj} shapes are different", left.shape, right.shape
2021-01-16T02:31:05.2699761Z )
2021-01-16T02:31:05.2700009Z
2021-01-16T02:31:05.2700245Z diff = 0
2021-01-16T02:31:05.2700598Z for left_arr, right_arr in zip(left, right):
2021-01-16T02:31:05.2700997Z # count up differences
2021-01-16T02:31:05.2701434Z if not array_equivalent(left_arr, right_arr, strict_nan=strict_nan):
2021-01-16T02:31:05.2701881Z diff += 1
2021-01-16T02:31:05.2702133Z
2021-01-16T02:31:05.2702418Z diff = diff * 100.0 / left.size
2021-01-16T02:31:05.2702802Z msg = f"{obj} values are different ({np.round(diff, 5)} %)"
2021-01-16T02:31:05.2703257Z > raise_assert_detail(obj, msg, left, right, index_values=index_values)
2021-01-16T02:31:05.2703684Z E AssertionError: numpy array are different
2021-01-16T02:31:05.2704002Z E
2021-01-16T02:31:05.2704325Z E numpy array values are different (33.33333 %)
2021-01-16T02:31:05.2704694Z E [left]: [True, True, True]
2021-01-16T02:31:05.2705054Z E [right]: [False, True, True]
2021-01-16T02:31:05.2705306Z
2021-01-16T02:31:05.2705579Z pandas/_testing.py:1159: AssertionError
2021-01-16T02:31:05.2706269Z _ TestComparison.test_index_series_compat[ne-Series-Series-assert_series_equal] _
2021-01-16T02:31:05.2706975Z [gw1] linux -- Python 3.8.5 /home/vsts/miniconda3/envs/pandas-dev/bin/python