

def test_getitem_setitem_datetime_tz_dateutil(self):
    tm._skip_if_no_dateutil()
    from dateutil.tz import tzutc
    from pandas.tslib import _dateutil_gettz as gettz
    tz = (lambda x: (tzutc() if (x == 'UTC') else gettz(x)))
    from pandas import date_range
    N = 50
    rng = date_range('1/1/1990', periods=N, freq='H', tz='US/Eastern')
    ts = Series(np.random.randn(N), index=rng)
    result = ts.copy()
    result['1990-01-01 09:00:00+00:00'] = 0
    result['1990-01-01 09:00:00+00:00'] = ts[4]
    assert_series_equal(result, ts)
    result = ts.copy()
    result['1990-01-01 03:00:00-06:00'] = 0
    result['1990-01-01 03:00:00-06:00'] = ts[4]
    assert_series_equal(result, ts)
    result = ts.copy()
    result[datetime(1990, 1, 1, 9, tzinfo=tz('UTC'))] = 0
    result[datetime(1990, 1, 1, 9, tzinfo=tz('UTC'))] = ts[4]
    assert_series_equal(result, ts)
    result = ts.copy()
    result[datetime(1990, 1, 1, 3, tzinfo=tz('US/Central'))] = 0
    result[datetime(1990, 1, 1, 3, tzinfo=tz('US/Central'))] = ts[4]
    assert_series_equal(result, ts)

dataset/ETHPy150Open pydata/pandas/pandas/tests/series/test_timeseries.py TestSeriesTimeSeries.test_getitem_setitem_datetime_tz_dateutil/original