MCPcopy Create free account
hub / github.com/PyMySQL/PyMySQL / _test_convert_timedelta

Method _test_convert_timedelta

pymysql/tests/test_converters.py:25–38  ·  view source on GitHub ↗
(self, with_negate=False, with_fsp=False)

Source from the content-addressed store, hash-verified

23 self.assertEqual(dt, expected)
24
25 def _test_convert_timedelta(self, with_negate=False, with_fsp=False):
26 d = {"hours": 789, "minutes": 12, "seconds": 34}
27 s = "%(hours)s:%(minutes)s:%(seconds)s" % d
28 if with_fsp:
29 d["microseconds"] = 511581
30 s += ".%(microseconds)s" % d
31
32 expected = datetime.timedelta(**d)
33 if with_negate:
34 expected = -expected
35 s = "-" + s
36
37 tdelta = converters.convert_timedelta(s)
38 self.assertEqual(tdelta, expected)
39
40 def test_convert_timedelta(self):
41 self._test_convert_timedelta(with_negate=False, with_fsp=False)

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected