Beispiel #1
0
 def test_should_serialize(self):
     instance = datetime.timedelta(days=12)
     schema_instance = TimeDeltaSchema()
     result = schema_instance.dump(instance)
     assert {
         "__type": "TimeDelta",
         "days": 12,
         "seconds": 0,
         "microseconds": 0
     } == result
 def test_should_deserialize(self):
     instance = {
         "__type": "TimeDelta",
         "days": 12,
         "seconds": 0,
         "microseconds": 0
     }
     schema_instance = TimeDeltaSchema()
     result = schema_instance.load(instance)
     expected_instance = datetime.timedelta(days=12)
     self.assertEqual(expected_instance, result)