def test_datetime(self):
    dt = datetime.now()
    result = self.dumps(dt)
    expected = self.datetime()
    for key in (k for k in expected if hasattr(dt, k)):
        expected[key] = getattr(dt, key)
    self.assertEqual(result, json.dumps(expected))
def test_datetime(self):
    dt = datetime.now()
    result = self.dumps(dt)
    expected = self.datetime()
    for key in (k for k in expected if hasattr(dt, k)):
        expected[key] = getattr(dt, key)
    self.assertEqual(result, json.dumps(expected))