MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_fromisoformat_timezone

Method test_fromisoformat_timezone

Lib/test/datetimetester.py:3325–3348  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3323 self.assertEqual(dt, dt_rt)
3324
3325 def test_fromisoformat_timezone(self):
3326 base_dt = self.theclass(2014, 12, 30, 12, 30, 45, 217456)
3327
3328 tzoffsets = [
3329 timedelta(hours=5), timedelta(hours=2),
3330 timedelta(hours=6, minutes=27),
3331 timedelta(hours=12, minutes=32, seconds=30),
3332 timedelta(hours=2, minutes=4, seconds=9, microseconds=123456)
3333 ]
3334
3335 tzoffsets += [-1 * td for td in tzoffsets]
3336
3337 tzinfos = [None, timezone.utc,
3338 timezone(timedelta(hours=0))]
3339
3340 tzinfos += [timezone(td) for td in tzoffsets]
3341
3342 for tzi in tzinfos:
3343 dt = base_dt.replace(tzinfo=tzi)
3344 dtstr = dt.isoformat()
3345
3346 with self.subTest(tstr=dtstr):
3347 dt_rt = self.theclass.fromisoformat(dtstr)
3348 assert dt == dt_rt, dt_rt
3349
3350 def test_fromisoformat_separators(self):
3351 separators = [

Callers

nothing calls this directly

Calls 6

timedeltaClass · 0.90
timezoneClass · 0.90
subTestMethod · 0.80
replaceMethod · 0.45
isoformatMethod · 0.45
fromisoformatMethod · 0.45

Tested by

no test coverage detected