MCPcopy
hub / github.com/pydantic/pydantic / test_offset_boundaries

Method test_offset_boundaries

pydantic-core/tests/test_tzinfo.py:197–214  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

195 self.assertEqual(tz_copy, tz)
196
197 def test_offset_boundaries(self):
198 # Test timedeltas close to the boundaries
199 time_deltas = [timedelta(hours=23, minutes=59), timedelta(hours=23, minutes=59, seconds=59)]
200 time_deltas.extend([-delta for delta in time_deltas])
201
202 for delta in time_deltas:
203 with self.subTest(test_type='good', delta=delta):
204 print(delta.total_seconds())
205 TzInfo(delta.total_seconds())
206
207 # Test timedeltas on and outside the boundaries
208 bad_time_deltas = [timedelta(hours=24), timedelta(hours=24, microseconds=1)]
209 bad_time_deltas.extend([-delta for delta in bad_time_deltas])
210
211 for delta in bad_time_deltas:
212 with self.subTest(test_type='bad', delta=delta):
213 with self.assertRaises(ValueError):
214 TzInfo(delta.total_seconds())
215
216 def test_no_args_constructor(self):
217 # Test that TzInfo can be constructed without arguments

Callers

nothing calls this directly

Calls 1

printFunction · 0.85

Tested by

no test coverage detected