@@ -19,26 +19,19 @@ class TestTimestampUnaryOps(object):
1919
2020 # --------------------------------------------------------------
2121 # Timestamp.round
22-
23- def test_round_day_naive (self ):
24- dt = Timestamp ('20130101 09:10:11' )
25- result = dt .round ('D' )
26- expected = Timestamp ('20130101' )
27- assert result == expected
28-
29- dt = Timestamp ('20130101 19:10:11' )
30- result = dt .round ('D' )
31- expected = Timestamp ('20130102' )
32- assert result == expected
33-
34- dt = Timestamp ('20130201 12:00:00' )
35- result = dt .round ('D' )
36- expected = Timestamp ('20130202' )
37- assert result == expected
38-
39- dt = Timestamp ('20130104 12:00:00' )
40- result = dt .round ('D' )
41- expected = Timestamp ('20130105' )
22+ @pytest .mark .parametrize ('timestamp, freq, expected' , [
23+ ('20130101 09:10:11' , 'D' , '20130101' ),
24+ ('20130101 19:10:11' , 'D' , '20130102' ),
25+ ('20130201 12:00:00' , 'D' , '20130202' ),
26+ ('20130104 12:00:00' , 'D' , '20130105' ),
27+ ('2000-01-05 05:09:15.13' , 'D' , '2000-01-05 00:00:00' ),
28+ ('2000-01-05 05:09:15.13' , 'H' , '2000-01-05 05:00:00' ),
29+ ('2000-01-05 05:09:15.13' , 'S' , '2000-01-05 05:09:15' )
30+ ])
31+ def test_round_frequencies (self , timestamp , freq , expected ):
32+ dt = Timestamp (timestamp )
33+ result = dt .round (freq )
34+ expected = Timestamp (expected )
4235 assert result == expected
4336
4437 def test_round_tzaware (self ):
@@ -85,16 +78,6 @@ def test_round_invalid_arg(self):
8578 with tm .assert_raises_regex (ValueError , INVALID_FREQ_ERR_MSG ):
8679 stamp .round ('foo' )
8780
88- @pytest .mark .parametrize ('freq, expected' , [
89- ('D' , Timestamp ('2000-01-05 00:00:00' )),
90- ('H' , Timestamp ('2000-01-05 05:00:00' )),
91- ('S' , Timestamp ('2000-01-05 05:09:15' ))])
92- def test_round_frequencies (self , freq , expected ):
93- stamp = Timestamp ('2000-01-05 05:09:15.13' )
94-
95- result = stamp .round (freq = freq )
96- assert result == expected
97-
9881 @pytest .mark .parametrize ('test_input, rounder, freq, expected' , [
9982 ('2117-01-01 00:00:45' , 'floor' , '15s' , '2117-01-01 00:00:45' ),
10083 ('2117-01-01 00:00:45' , 'ceil' , '15s' , '2117-01-01 00:00:45' ),
0 commit comments