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

Method test_fromisocalendar

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

Source from the content-addressed store, hash-verified

2112 self.theclass.fromisoformat(bad_type)
2113
2114 def test_fromisocalendar(self):
2115 # For each test case, assert that fromisocalendar is the
2116 # inverse of the isocalendar function
2117 dates = [
2118 (2016, 4, 3),
2119 (2005, 1, 2), # (2004, 53, 7)
2120 (2008, 12, 30), # (2009, 1, 2)
2121 (2010, 1, 2), # (2009, 53, 6)
2122 (2009, 12, 31), # (2009, 53, 4)
2123 (1900, 1, 1), # Unusual non-leap year (year % 100 == 0)
2124 (1900, 12, 31),
2125 (2000, 1, 1), # Unusual leap year (year % 400 == 0)
2126 (2000, 12, 31),
2127 (2004, 1, 1), # Leap year
2128 (2004, 12, 31),
2129 (1, 1, 1),
2130 (9999, 12, 31),
2131 (MINYEAR, 1, 1),
2132 (MAXYEAR, 12, 31),
2133 ]
2134
2135 for datecomps in dates:
2136 with self.subTest(datecomps=datecomps):
2137 dobj = self.theclass(*datecomps)
2138 isocal = dobj.isocalendar()
2139
2140 d_roundtrip = self.theclass.fromisocalendar(*isocal)
2141
2142 self.assertEqual(dobj, d_roundtrip)
2143
2144 def test_fromisocalendar_value_errors(self):
2145 isocals = [

Callers

nothing calls this directly

Calls 4

subTestMethod · 0.80
isocalendarMethod · 0.80
fromisocalendarMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected