MCPcopy Index your code
hub / github.com/python/cpython / test_fromisocalendar

Method test_fromisocalendar

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected