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

Method test_fromisoformat

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

Source from the content-addressed store, hash-verified

2014 self.assertIn(f"day 32 must be in range 1..31 for month 1 in year 2009", str(msg.exception))
2015
2016 def test_fromisoformat(self):
2017 # Test that isoformat() is reversible
2018 base_dates = [
2019 (1, 1, 1),
2020 (1000, 2, 14),
2021 (1900, 1, 1),
2022 (2000, 2, 29),
2023 (2004, 11, 12),
2024 (2004, 4, 3),
2025 (2017, 5, 30)
2026 ]
2027
2028 for dt_tuple in base_dates:
2029 dt = self.theclass(*dt_tuple)
2030 dt_str = dt.isoformat()
2031 with self.subTest(dt_str=dt_str):
2032 dt_rt = self.theclass.fromisoformat(dt.isoformat())
2033
2034 self.assertEqual(dt, dt_rt)
2035
2036 def test_fromisoformat_date_examples(self):
2037 examples = [

Callers

nothing calls this directly

Calls 4

subTestMethod · 0.80
isoformatMethod · 0.45
fromisoformatMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected