@@ -705,12 +705,41 @@ def test_to_timestamp_microsecond(self, ts, expected, freq):
705
705
# --------------------------------------------------------------
706
706
# Rendering: __repr__, strftime, etc
707
707
708
- def test_repr (self ):
709
- p = Period ("Jan-2000" )
710
- assert "2000-01" in repr (p )
711
-
712
- p = Period ("2000-12-15" )
713
- assert "2000-12-15" in repr (p )
708
+ @pytest .mark .parametrize ("str_ts,freq,str_res" , (
709
+ ("Jan-2000" , None , "2000-01" ),
710
+ ("2000-12-15" , None , "2000-12-15" ),
711
+ ("2000-12-15" , "N" , "2000-12-15 00:00:00.000000000" ),
712
+ ("2000-12-15" , "U" , "2000-12-15 00:00:00.000000" ),
713
+ ("2000-12-15" , "L" , "2000-12-15 00:00:00.000" ),
714
+ ("2000-12-15" , "S" , "2000-12-15 00:00:00" ),
715
+ ("2000-12-15" , "T" , "2000-12-15 00:00" ),
716
+ ("2000-12-15" , "H" , "2000-12-15 00:00" ),
717
+ # ("2000-12-15", "BH", "2000-12-15"),
718
+ # ("2000-12-15", "BYS", "2000-12-15"),
719
+ # ("2000-12-15", "YS", "2000-12-15"),
720
+ # ("2000-12-15", "BY", "2000-12-15"),
721
+ ("2000-12-15" , "Y" , "2000" ),
722
+ # ("2000-12-15", "BQS", "2000-12-15"),
723
+ # ("2000-12-15", "QS", "2000-12-15"),
724
+ # ("2000-12-15", "BQ", "2000-12-15"),
725
+ ("2000-12-15" , "Q" , "2000Q4" ),
726
+ # ("2000-12-15", "CBMS", "2000-12-15"),
727
+ # ("2000-12-15", "BMS", "2000-12-15"),
728
+ # ("2000-12-15", "SMS", "2000-12-15"),
729
+ # ("2000-12-15", "MS", "2000-12-15"),
730
+ # ("2000-12-15", "CBM", "2000-12-15"),
731
+ # ("2000-12-15", "BM", "2000-12-15"),
732
+ # ("2000-12-15", "SM", "2000-12-15"),
733
+ ("2000-12-15" , "M" , "2000-12" ),
734
+ ("2000-12-15" , "W" , "2000-12-11/2000-12-17" ),
735
+ ("2000-12-15" , "D" , "2000-12-15" ),
736
+ # ("2000-12-15", "C", "2000-12-15"),
737
+ ("2000-12-15" , "B" , "2000-12-15" ),
738
+ ))
739
+ def test_repr (self , str_ts , freq , str_res ):
740
+ p = Period (str_ts , freq = freq )
741
+ assert str (p ) == str_res
742
+ assert str_res in repr (p )
714
743
715
744
def test_repr_nat (self ):
716
745
p = Period ("nat" , freq = "M" )
0 commit comments