def test_TimeDelta_eval(self): "Test pyson.TimeDelta.eval" eval = pyson.PYSONEncoder().encode(pyson.TimeDelta(1, 2, 3)) self.assertEqual(pyson.PYSONDecoder().decode(eval), datetime.timedelta(1, 2, 3))
def test_TimeDelta_types(self): "Test pyson.TimeDelta.types" self.assertEqual( pyson.TimeDelta(seconds=10).types(), {datetime.timedelta})
def test_TimeDelta_invalid_type(self): "Test pyson.TimeDelta invalid type" with self.assertRaises(AssertionError): pyson.TimeDelta('foo')
def test_TimeDelta_repr(self): "Test pyson.TimeDelta.repr" self.assertEqual(repr(pyson.TimeDelta(1, 2, 3)), 'TimeDelta(1, 2, 3)')