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

Method test_roundtrip

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

Source from the content-addressed store, hash-verified

2220 self.assertEqual(dt.microsecond, 8000)
2221
2222 def test_roundtrip(self):
2223 for dt in (self.theclass(1, 2, 3, 4, 5, 6, 7),
2224 self.theclass.now()):
2225 # Verify dt -> string -> datetime identity.
2226 s = repr(dt)
2227 self.assertStartsWith(s, 'datetime.')
2228 s = s[9:]
2229 dt2 = eval(s)
2230 self.assertEqual(dt, dt2)
2231
2232 # Verify identity via reconstructing from pieces.
2233 dt2 = self.theclass(dt.year, dt.month, dt.day,
2234 dt.hour, dt.minute, dt.second,
2235 dt.microsecond)
2236 self.assertEqual(dt, dt2)
2237
2238 def test_isoformat(self):
2239 t = self.theclass(1, 2, 3, 4, 5, 1, 123)

Callers

nothing calls this directly

Calls 5

reprFunction · 0.85
nowMethod · 0.80
evalFunction · 0.50
assertStartsWithMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected