'mark.parametrize over same IntervalIndex and avoid repetition

I want to parametrize like below but I want to avoid repetition of Interval index 3 times. Is there a better way to do it?

@pytest.mark.parametrize("arrays",
    [ 
        IntervalIndex.from_breaks([
                        pd.Timestamp("2018-01-02"), pd.Timestamp("2018-01-05"), pd.Timestamp("2018-01-08"), pd.Timestamp("2018-01-11")], 
                        closed='both'),
        pd.array(IntervalIndex.from_breaks([
                        pd.Timestamp("2018-01-02"), pd.Timestamp("2018-01-05"), pd.Timestamp("2018-01-08"), pd.Timestamp("2018-01-11")], 
                        closed='both')),
        list(IntervalIndex.from_breaks([
                        pd.Timestamp("2018-01-02"), pd.Timestamp("2018-01-05"), pd.Timestamp("2018-01-08"), pd.Timestamp("2018-01-11")],
                        closed='both')),
        ]
    )


def test_IntervalIndex_get_indexer_non_unique(self, arrays):
               
    int_inx = interval_range(Timestamp("2018-01-02"), freq="3D", periods=3)

    actual = int_inx.get_indexer_non_unique(arrays)
    expected = (np.array([0, 1, 2], dtype=np.int64), np.array([], dtype=np.int64))

    tm.assert_equal(actual, expected)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source