MCPcopy
hub / github.com/celery/celery / test_when_is_ambiguous

Method test_when_is_ambiguous

t/unit/utils/test_time.py:283–298  ·  view source on GitHub ↗
(self, datetime_ambiguous_mock)

Source from the content-addressed store, hash-verified

281
282 @patch('dateutil.tz.datetime_ambiguous')
283 def test_when_is_ambiguous(self, datetime_ambiguous_mock):
284 class tzz(tzinfo):
285
286 def utcoffset(self, dt):
287 return None # Mock no utcoffset specified
288
289 def is_ambiguous(self, dt):
290 return True
291
292 datetime_ambiguous_mock.return_value = False
293 tz = tzz()
294 assert localize(make_aware(datetime.now(_timezone.utc), tz), tz)
295
296 datetime_ambiguous_mock.return_value = True
297 tz2 = tzz()
298 assert localize(make_aware(datetime.now(_timezone.utc), tz2), tz2)
299
300 def test_localize_changes_utc_dt(self):
301 now_utc_time = datetime.now(tz=ZoneInfo("UTC"))

Callers

nothing calls this directly

Calls 4

localizeFunction · 0.90
make_awareFunction · 0.90
tzzClass · 0.85
nowMethod · 0.45

Tested by

no test coverage detected