• Home
  • Raw
  • Download

Lines Matching refs:timezone

30 from datetime import timezone
202 (timezone, (offset,)),
203 (timezone, (offset, "EST"))]:
244 self.ACDT = timezone(timedelta(hours=9.5), 'ACDT')
245 self.EST = timezone(-timedelta(hours=5), 'EST')
249 for tz in [self.ACDT, self.EST, timezone.utc,
250 timezone.min, timezone.max]:
255 for tz in [self.ACDT, self.EST, timezone.utc,
256 timezone.min, timezone.max]:
263 self.assertEqual(timezone.utc.utcoffset(None), ZERO)
264 self.assertEqual(timezone.min.utcoffset(None), -limit)
265 self.assertEqual(timezone.max.utcoffset(None), limit)
268 self.assertIs(timezone.utc, timezone(timedelta(0)))
269 self.assertIsNot(timezone.utc, timezone(timedelta(0), 'UTC'))
270 self.assertEqual(timezone.utc, timezone(timedelta(0), 'UTC'))
272 tz = timezone(subminute)
276 self.assertRaises(ValueError, timezone, invalid)
277 self.assertRaises(ValueError, timezone, -invalid)
279 with self.assertRaises(TypeError): timezone(None)
280 with self.assertRaises(TypeError): timezone(42)
281 with self.assertRaises(TypeError): timezone(ZERO, None)
282 with self.assertRaises(TypeError): timezone(ZERO, 42)
283 with self.assertRaises(TypeError): timezone(ZERO, 'ABC', 'extra')
286 self.assertIsInstance(timezone.utc, tzinfo)
293 self.assertEqual(offset, timezone(offset).utcoffset(dummy))
294 self.assertEqual(-offset, timezone(-offset).utcoffset(dummy))
301 self.assertIsNone(timezone.utc.dst(self.DT))
307 self.assertEqual('UTC', timezone.utc.tzname(None))
308 self.assertEqual('UTC', timezone(ZERO).tzname(None))
309 self.assertEqual('UTC-05:00', timezone(-5 * HOUR).tzname(None))
310 self.assertEqual('UTC+09:30', timezone(9.5 * HOUR).tzname(None))
311 self.assertEqual('UTC-00:01', timezone(timedelta(minutes=-1)).tzname(None))
312 self.assertEqual('XYZ', timezone(-5 * HOUR, 'XYZ').tzname(None))
314 self.assertEqual('\ud800', timezone(ZERO, '\ud800').tzname(None))
317 self.assertEqual('UTC+01:06:40', timezone(timedelta(0, 4000)).tzname(None))
319 timezone(-timedelta(0, 4000)).tzname(None))
321 timezone(timedelta(0, 4000, 1)).tzname(None))
323 timezone(-timedelta(0, 4000, 1)).tzname(None))
330 timezone.utc.fromutc(self.DT)
332 timezone.utc.fromutc('not datetime')
338 self.DT.replace(tzinfo=timezone.utc))
341 self.assertNotEqual(timezone(ZERO), timezone(HOUR))
342 self.assertEqual(timezone(HOUR), timezone(HOUR))
343 self.assertEqual(timezone(-5 * HOUR), timezone(-5 * HOUR, 'EST'))
344 with self.assertRaises(TypeError): timezone(ZERO) < timezone(ZERO)
345 self.assertIn(timezone(ZERO), {timezone(ZERO)})
346 self.assertTrue(timezone(ZERO) != None)
347 self.assertFalse(timezone(ZERO) == None)
349 tz = timezone(ZERO)
364 for tz in [timezone.min, timezone.max, timezone.utc]:
373 for tz in self.ACDT, self.EST, timezone.min, timezone.max:
377 tz = timezone.utc
383 for tz in self.ACDT, self.EST, timezone.min, timezone.max:
386 tz = timezone.utc
391 for tz in self.ACDT, self.EST, timezone.min, timezone.max:
394 tz = timezone.utc
409 timezone(delta)
421 timezone(delta)
426 self.assertNotEqual(timezone.utc, tzinfo())
427 self.assertNotEqual(timezone(timedelta(hours=1)), tzinfo())
2017 t = self.theclass(1, 2, 3, 4, 5, 1, 999500, tzinfo=timezone.utc)
2050 ('+00:00', timezone.utc),
2051 ('+00:00', timezone(timedelta(0))),
2055 (prefix + expected, timezone(sign * td))
2420 t = self.theclass(1970, 1, 1, tzinfo=timezone.utc)
2422 t = self.theclass(1970, 1, 1, 1, 2, 3, 4, tzinfo=timezone.utc)
2426 tzinfo=timezone(timedelta(hours=-5), 'EST'))
2473 min_dt = self.theclass.min.replace(tzinfo=timezone.utc)
2477 self.assertEqual(self.theclass.fromtimestamp(min_ts, tz=timezone.utc),
2485 max_dt = self.theclass.max.replace(tzinfo=timezone.utc,
2489 self.assertEqual(self.theclass.fromtimestamp(max_ts, tz=timezone.utc),
2587 (-_time.timezone, _time.tzname[0])):
2675 tz = timezone(-timedelta(hours=2, seconds=s, microseconds=us))
2715 dt = combine(d, t, timezone.utc)
2716 self.assertIs(dt.tzinfo, timezone.utc)
2717 dt = combine(d, t, tzinfo=timezone.utc)
2718 self.assertIs(dt.tzinfo, timezone.utc)
2753 dt_utc = dt.replace(tzinfo=timezone(timedelta(hours=-4), 'EDT'))
2832 ('fromtimestamp', (ts, timezone.utc),
2833 base_d.astimezone(timezone.utc)),
2870 ('now_utc', 'now', {'tz': timezone.utc}),
2871 ('now_fixed', 'now', {'tz': timezone(timedelta(hours=-5), "EST")}),
2900 tzinfos = [None, timezone.utc,
2901 timezone(timedelta(hours=-5)),
2902 timezone(timedelta(hours=2))]
2929 tzinfos = [None, timezone.utc,
2930 timezone(timedelta(hours=0))]
2932 tzinfos += [timezone(td) for td in tzoffsets]
2975 tzinfos = [None, timezone.utc,
2976 timezone(timedelta(hours=-5)),
2977 timezone(timedelta(hours=2)),
2978 timezone(timedelta(hours=6, minutes=27))]
3046 self.assertIs(dt.tzinfo, timezone.utc)
3053 tzinfo=timezone(timedelta(hours=10, minutes=45)))
3257 ('+00:00', timezone.utc),
3258 ('+00:00', timezone(timedelta(0))),
3262 (prefix + expected, timezone(sign * td))
3890 tzinfos = [None, timezone.utc,
3891 timezone(timedelta(hours=2)),
3892 timezone(timedelta(hours=6, minutes=27))]
3915 tzinfos = [None, timezone.utc,
3916 timezone(timedelta(hours=0))]
3918 tzinfos += [timezone(td) for td in tzoffsets]
3934 tzinfos = [None, timezone.utc,
3935 timezone(timedelta(hours=-5)),
3936 timezone(timedelta(hours=2)),
3937 timezone(timedelta(hours=6, minutes=27))]
3999 tsc = TimeSubclass(12, 14, 45, 203745, tzinfo=timezone.utc)
4296 tza = timezone(HOUR, 'A')
4297 tzb = timezone(HOUR, 'B')
4324 timezone(timedelta(hours=15, minutes=58), "weirdtz"),]:
4491 for tz in [timezone.min, timezone.utc, timezone.max]:
4494 dtz.astimezone(timezone.utc).timetuple()[:-1])
4506 tiny = cls.min.replace(tzinfo=timezone(MINUTE))
4508 huge = cls.max.replace(tzinfo=timezone(-MINUTE))
4602 dt = self.theclass.now(timezone.utc)
4610 dt = self.theclass(2012, 11, 4, 6, 30, tzinfo=timezone.utc)
4614 dt = self.theclass(2012, 11, 4, 5, 30, tzinfo=timezone.utc)
4622 u = datetime(2015, 11, 1, 5, tzinfo=timezone.utc)
5102 timezone(timedelta())]:
5313 gdt = datetime(1941, 6, 23, 20, 59, 59, tzinfo=timezone.utc)
5320 gdt = datetime(1941, 6, 23, 21, tzinfo=timezone.utc)
5327 gdt = datetime(1941, 6, 23, 22, tzinfo=timezone.utc)
5338 gdt = ldt.astimezone(timezone.utc)
5343 gdt = ldt.astimezone(timezone.utc)
5348 gdt = ldt.astimezone(timezone.utc)
5353 gdt = ldt.astimezone(timezone.utc)
5557 self.assertEqual(t, t.astimezone(timezone.utc))
5559 self.assertEqual(t, t.astimezone(timezone.utc))
5563 t_fold_utc = t_fold.astimezone(timezone.utc)
5569 t_gap_utc = t_gap.astimezone(timezone.utc)
5842 adt = udt.replace(tzinfo=timezone.utc).astimezone(tz)
5847 self.assertEquivDatetimes(ldt.astimezone(timezone.utc),
5848 udt.replace(tzinfo=timezone.utc))
5865 adt = udt.replace(tzinfo=timezone.utc).astimezone(tz)
5957 self.assertIs(capi_utc, timezone.utc)
5962 exp_named = timezone(timedelta(hours=-5), "EST")
5963 exp_unnamed = timezone(timedelta(hours=-5))
5981 dt_utc = datetime(2000, 2, 4, 5, tzinfo=timezone.utc)
5983 self.assertEqual(dt1.astimezone(timezone.utc), dt_utc)
6048 self.assertIs(utc0, timezone.utc)
6051 self.assertIs(utc1, timezone.utc)
6054 self.assertIsNot(non_utc, timezone.utc)
6056 non_utc_exp = timezone(timedelta(hours=0), "")
6088 timedelta(1), timezone.utc, time(12, 00)]
6113 timedelta(1), timezone.utc, date(2011, 1, 1)]
6139 timedelta(1), timezone.utc, date(2011, 1, 1)]
6165 timezone.utc, date(2011, 1, 1), datetime(2011, 1, 1)]
6178 tz = timezone(timedelta(hours=-5))
6308 ((1995, 4, 12), timezone(timedelta(hours=1)), True),
6311 ((1995, 4, 12, 14, 30), timezone(timedelta(hours=1)), True),