File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,7 +30,6 @@ def build_timestamps(
3030 while current < end_at :
3131 if (
3232 current .hour == 0
33- and current != start_at
3433 and current < end_at .replace (hour = 0 )
3534 ):
3635 timestamps .append ((current .strftime ("%Y-%m-%d" ), current ))
Original file line number Diff line number Diff line change @@ -96,6 +96,14 @@ def test_build_timestamps_long():
9696 map (lambda x : x [0 ], result )
9797 ) # Complete day in the middle
9898
99+ def test_build_timestamps_long_2 ():
100+ start = datetime .strptime ("2024-01-01" , "%Y-%m-%d" )
101+ end = datetime .strptime ("2024-02-01" , "%Y-%m-%d" )
102+ result = build_timestamps (start , end )
103+
104+ assert result [0 ][0 ] == "2024-01-01" # First day
105+ assert result [- 1 ][0 ] == "2024-01-31" # Last day
106+ assert len (result ) == 31
99107
100108def test_build_timestamps_single_day ():
101109 start = datetime .strptime ("2024-01-01 01" , "%Y-%m-%d %H" )
@@ -111,7 +119,7 @@ def test_build_timestamps_midnight():
111119 end = datetime .strptime ("2024-01-03 00" , "%Y-%m-%d %H" )
112120 result = build_timestamps (start , end )
113121
114- assert result [0 ][0 ] == "2024-01-01T00 "
122+ assert result [0 ][0 ] == "2024-01-01 "
115123 assert "2024-01-02" in list (map (lambda x : x [0 ], result ))
116124 assert result [- 1 ][0 ] == "2024-01-02"
117125
You can’t perform that action at this time.
0 commit comments