@pytest.mark.parametrize('fill_val', [pd.Timestamp('2012-01-01'), pd.Timestamp('2012-01-01').to_datetime64(), pd.Timestamp('2012-01-01').to_pydatetime()])
def test_where_index_datetime(self, fill_val):
    exp_dtype = 'datetime64[ns]'
    obj = pd.Index([pd.Timestamp('2011-01-01'), pd.Timestamp('2011-01-02'), pd.Timestamp('2011-01-03'), pd.Timestamp('2011-01-04')])
    assert (obj.dtype == 'datetime64[ns]')
    cond = pd.Index([True, False, True, False])
    result = obj.where(cond, fill_val)
    expected = pd.DatetimeIndex([obj[0], fill_val, obj[2], fill_val])
    tm.assert_index_equal(result, expected)
    values = pd.Index(pd.date_range(fill_val, periods=4))
    exp = pd.Index([pd.Timestamp('2011-01-01'), pd.Timestamp('2012-01-02'), pd.Timestamp('2011-01-03'), pd.Timestamp('2012-01-04')])
    self._assert_where_conversion(obj, cond, values, exp, exp_dtype)
@pytest.mark.parametrize('fill_val', [pd.Timestamp('2012-01-01'), pd.Timestamp('2012-01-01').to_datetime64(), pd.Timestamp('2012-01-01').to_pydatetime()])
def test_where_index_datetime(self, fill_val):
    exp_dtype = 'datetime64[ns]'
    obj = pd.Index([pd.Timestamp('2011-01-01'), pd.Timestamp('2011-01-02'), pd.Timestamp('2011-01-03'), pd.Timestamp('2011-01-04')])
    assert (obj.dtype == 'datetime64[ns]')
    cond = pd.Index([True, False, True, False])
    result = obj.where(cond, fill_val)
    expected = pd.DatetimeIndex([obj[0], fill_val, obj[2], fill_val])
    tm.assert_index_equal(result, expected)
    values = pd.Index(pd.date_range(fill_val, periods=4))
    exp = pd.Index([pd.Timestamp('2011-01-01'), pd.Timestamp('2012-01-02'), pd.Timestamp('2011-01-03'), pd.Timestamp('2012-01-04')])
    self._assert_where_conversion(obj, cond, values, exp, exp_dtype)