Skip to content

Commit

Permalink
Adding tests for IntervalArray.unique() for DateTimeArrays with time …
Browse files Browse the repository at this point in the history
…zones (pandas-dev#46153)
  • Loading branch information
Dr-Irv authored Feb 26, 2022
1 parent 19aa5ab commit c2188de
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pandas/tests/series/methods/test_unique.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

from pandas import (
Categorical,
IntervalIndex,
Series,
date_range,
)
import pandas._testing as tm

Expand Down Expand Up @@ -56,3 +58,19 @@ def test_unique_categorical(self):
ser = Series(cat)
result = ser.unique()
tm.assert_categorical_equal(result, cat)

def test_tz_unique(self):
# GH 46128
dti1 = date_range("2016-01-01", periods=3)
ii1 = IntervalIndex.from_breaks(dti1)
ser1 = Series(ii1)
uni1 = ser1.unique()
tm.assert_interval_array_equal(ser1.array, uni1)

dti2 = date_range("2016-01-01", periods=3, tz="US/Eastern")
ii2 = IntervalIndex.from_breaks(dti2)
ser2 = Series(ii2)
uni2 = ser2.unique()
tm.assert_interval_array_equal(ser2.array, uni2)

assert uni1.dtype != uni2.dtype

0 comments on commit c2188de

Please sign in to comment.