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

Method test_roundtrip

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

Source from the content-addressed store, hash-verified

1227 self.assertEqual(dt.day, 1)
1228
1229 def test_roundtrip(self):
1230 for dt in (self.theclass(1, 2, 3),
1231 self.theclass.today()):
1232 # Verify dt -> string -> date identity.
1233 s = repr(dt)
1234 self.assertStartsWith(s, 'datetime.')
1235 s = s[9:]
1236 dt2 = eval(s)
1237 self.assertEqual(dt, dt2)
1238
1239 # Verify identity via reconstructing from pieces.
1240 dt2 = self.theclass(dt.year, dt.month, dt.day)
1241 self.assertEqual(dt, dt2)
1242
1243 def test_repr_subclass(self):
1244 """Subclasses should have bare names in the repr (gh-107773)."""

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected