|
@@ -193,6 +193,34 @@ class TestTimeUtils(unittest.TestCase):
|
193
|
193
|
self.assertTrue(git_oh.in_office_hours(moment,
|
194
|
194
|
starthour, stophour, weekend=weekend))
|
195
|
195
|
|
|
196
|
+ def test_office_hours_midnight(self):
|
|
197
|
+ """ Test in_office_hours special case for daystop at midnight """
|
|
198
|
+ starthour = datetime.time(12,0)
|
|
199
|
+ stophour = datetime.time(0,0)
|
|
200
|
+
|
|
201
|
+ moment = datetime.datetime.fromisoformat("2023-11-01T09:00+0200")
|
|
202
|
+ self.assertFalse(git_oh.in_office_hours(moment, starthour, stophour))
|
|
203
|
+
|
|
204
|
+ moment = datetime.datetime.fromisoformat("2023-11-01T13:00+0200")
|
|
205
|
+ self.assertTrue(git_oh.in_office_hours(moment, starthour, stophour))
|
|
206
|
+
|
|
207
|
+ def test_office_hours_nightwork(self):
|
|
208
|
+ """ Testing in_office_hours when daystop < daystart """
|
|
209
|
+ starthour = datetime.time(20,0)
|
|
210
|
+ stophour = datetime.time(8,0)
|
|
211
|
+
|
|
212
|
+ moment = datetime.datetime.fromisoformat("2023-11-01T00:00+0200")
|
|
213
|
+ self.assertTrue(git_oh.in_office_hours(moment, starthour, stophour))
|
|
214
|
+
|
|
215
|
+ moment = datetime.datetime.fromisoformat("2023-11-01T05:00+0200")
|
|
216
|
+ self.assertTrue(git_oh.in_office_hours(moment, starthour, stophour))
|
|
217
|
+
|
|
218
|
+ moment = datetime.datetime.fromisoformat("2023-11-01T23:00+0200")
|
|
219
|
+ self.assertTrue(git_oh.in_office_hours(moment, starthour, stophour))
|
|
220
|
+
|
|
221
|
+ moment = datetime.datetime.fromisoformat("2023-11-01T12:00+0200")
|
|
222
|
+ self.assertFalse(git_oh.in_office_hours(moment, starthour, stophour))
|
|
223
|
+
|
196
|
224
|
def test_office_hours_tz_drop(self):
|
197
|
225
|
""" Checks that in_office_hours do not use tzinfo to compare
|
198
|
226
|
moment with start & stop hours
|