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

Method test_strptime_exception_context

Lib/test/test_time.py:344–352  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

342 self.assertRaises(TypeError, time.strptime, '2009', b'%Y')
343
344 def test_strptime_exception_context(self):
345 # check that this doesn't chain exceptions needlessly (see #17572)
346 with self.assertRaises(ValueError) as e:
347 time.strptime('', '%D')
348 self.assertTrue(e.exception.__suppress_context__)
349 # additional check for stray % branch
350 with self.assertRaises(ValueError) as e:
351 time.strptime('%', '%')
352 self.assertTrue(e.exception.__suppress_context__)
353
354 def test_strptime_leap_year(self):
355 # GH-70647: warns if parsing a format with a day and no year.

Callers

nothing calls this directly

Calls 3

assertTrueMethod · 0.80
assertRaisesMethod · 0.45
strptimeMethod · 0.45

Tested by

no test coverage detected