File tree 1 file changed +18
-0
lines changed
pandas/tests/series/methods
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
from pandas import (
4
4
Categorical ,
5
+ IntervalIndex ,
5
6
Series ,
7
+ date_range ,
6
8
)
7
9
import pandas ._testing as tm
8
10
@@ -56,3 +58,19 @@ def test_unique_categorical(self):
56
58
ser = Series (cat )
57
59
result = ser .unique ()
58
60
tm .assert_categorical_equal (result , cat )
61
+
62
+ def test_tz_unique (self ):
63
+ # GH 46128
64
+ dti1 = date_range ("2016-01-01" , periods = 3 )
65
+ ii1 = IntervalIndex .from_breaks (dti1 )
66
+ ser1 = Series (ii1 )
67
+ uni1 = ser1 .unique ()
68
+ tm .assert_interval_array_equal (ser1 .array , uni1 )
69
+
70
+ dti2 = date_range ("2016-01-01" , periods = 3 , tz = "US/Eastern" )
71
+ ii2 = IntervalIndex .from_breaks (dti2 )
72
+ ser2 = Series (ii2 )
73
+ uni2 = ser2 .unique ()
74
+ tm .assert_interval_array_equal (ser2 .array , uni2 )
75
+
76
+ assert uni1 .dtype != uni2 .dtype
You can’t perform that action at this time.
0 commit comments