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

Method test_roundtrip

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

Source from the content-addressed store, hash-verified

2259 self.assertEqual(dt.microsecond, 8000)
2260
2261 def test_roundtrip(self):
2262 for dt in (self.theclass(1, 2, 3, 4, 5, 6, 7),
2263 self.theclass.now()):
2264 # Verify dt -> string -> datetime identity.
2265 s = repr(dt)
2266 self.assertStartsWith(s, 'datetime.')
2267 s = s[9:]
2268 dt2 = eval(s)
2269 self.assertEqual(dt, dt2)
2270
2271 # Verify identity via reconstructing from pieces.
2272 dt2 = self.theclass(dt.year, dt.month, dt.day,
2273 dt.hour, dt.minute, dt.second,
2274 dt.microsecond)
2275 self.assertEqual(dt, dt2)
2276
2277 def test_isoformat(self):
2278 t = self.theclass(1, 2, 3, 4, 5, 1, 123)

Callers

nothing calls this directly

Calls 3

nowMethod · 0.80
assertStartsWithMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected