@@ -605,6 +605,14 @@ def test_representation(self):
605
605
result = getattr (idx , func )()
606
606
self .assertEqual (result , expected )
607
607
608
+ def test_resolution (self ):
609
+ for freq , expected in zip (['A' , 'Q' , 'M' , 'D' , 'H' , 'T' , 'S' , 'L' , 'U' ],
610
+ ['day' , 'day' , 'day' , 'day' ,
611
+ 'hour' , 'minute' , 'second' , 'millisecond' , 'microsecond' ]):
612
+ for tz in [None , 'Asia/Tokyo' , 'US/Eastern' ]:
613
+ idx = pd .date_range (start = '2013-04-01' , periods = 30 , freq = freq , tz = tz )
614
+ self .assertEqual (idx .resolution , expected )
615
+
608
616
609
617
class TestPeriodIndexOps (Ops ):
610
618
_allowed = '_allow_period_index_ops'
@@ -729,6 +737,14 @@ def test_representation(self):
729
737
result = getattr (idx , func )()
730
738
self .assertEqual (result , expected )
731
739
740
+ def test_resolution (self ):
741
+ for freq , expected in zip (['A' , 'Q' , 'M' , 'D' , 'H' , 'T' , 'S' , 'L' , 'U' ],
742
+ ['day' , 'day' , 'day' , 'day' ,
743
+ 'hour' , 'minute' , 'second' , 'millisecond' , 'microsecond' ]):
744
+
745
+ idx = pd .period_range (start = '2013-04-01' , periods = 30 , freq = freq )
746
+ self .assertEqual (idx .resolution , expected )
747
+
732
748
733
749
if __name__ == '__main__' :
734
750
import nose
0 commit comments