# Path: foil/serializers.py
# @singledispatch
# def json_serializer(obj):
#     return json.dumps(obj)


import json
import unittest
import uuid
import pytz
from datetime import date, datetime
from foil.serializers import json_serializer
        result = self._serialize(dt)

        self.assertEquals(expected, result)

    def test_serialize_utc_datetime(self):
        dt = datetime(2015, 3, 13, 20, 33, 22, 567, tzinfo=pytz.UTC)

        expected = '"{}Z"'.format(dt.strftime('%Y-%m-%dT%H:%M:%S.%f'))
        result = self._serialize(dt)

        self.assertEqual(expected, result)

    def test_serialize_aware_datetime(self):
        eastern_zone = pytz.timezone('US/Eastern')
        dt = eastern_zone.localize(datetime(2015, 3, 13, 20, 33, 22, 567))

        expected = '"2015-03-13T20:33:22.000567-04:00"'
        result = self._serialize(dt)

        self.assertEqual(expected, result)

    def test_serialize_object(self):
        data = {'hello': 'world'}

        expected = json.dumps(data)
        result = json_serializer(data)

        self.assertEqual(expected, result)

    def _serialize(self, obj):

# Path: foil/serializers.py
# @singledispatch
# def json_serializer(obj):
#     return json.dumps(obj)


# Path: tests/test_serializers.py
import json
import unittest
import uuid
import pytz
from datetime import date, datetime
from foil.serializers import json_serializer

        result = self._serialize(dt)

        self.assertEquals(expected, result)

    def test_serialize_utc_datetime(self):
        dt = datetime(2015, 3, 13, 20, 33, 22, 567, tzinfo=pytz.UTC)

        expected = '"{}Z"'.format(dt.strftime('%Y-%m-%dT%H:%M:%S.%f'))
        result = self._serialize(dt)

        self.assertEqual(expected, result)

    def test_serialize_aware_datetime(self):
        eastern_zone = pytz.timezone('US/Eastern')
        dt = eastern_zone.localize(datetime(2015, 3, 13, 20, 33, 22, 567))

        expected = '"2015-03-13T20:33:22.000567-04:00"'
        result = self._serialize(dt)

        self.assertEqual(expected, result)

    def test_serialize_object(self):
        data = {'hello': 'world'}

        expected = json.dumps(data)
        result = json_serializer(data)

        self.assertEqual(expected, result)

    def _serialize(self, obj):

        return json.dumps(obj, default=json_serializer)