def test_default_json_encoder_datetime(self): now = datetime.utcnow() self.assertEqual(default_json_encoder(now), now.isoformat())
def test_default_json_encoder_unhandled(self): self.assertIsNone(default_json_encoder(1), None)
def test_default_json_encoder_decimal(self): self.assertAlmostEqual( default_json_encoder(Decimal("1.2")), 1.2, places=2)