# Path: testproject/db/models.py
# class DummyObject(object):
#     """
#     Dummy object for storing in pickle field.
#     """
#     def __eq__(self, other):
#         return type(self) == type(other)
# 
# class JSONModel(models.Model):
#     """
#     Dummy model for testing ``JSONField`` fields.
#     """
#     bool_field = JSONField(_('bool field'), blank=True, default=True)
#     dict_field = JSONField(_('dict field'), blank=True, default={})
#     float_field = JSONField(_('float field'), blank=True, default=0.0)
#     int_field = JSONField(_('int field'), blank=True, default=0)
#     list_field = JSONField(_('list field'), blank=True, default=[])
#     none_field = JSONField(_('None field'), blank=True, default=None)
#     str_field = JSONField(_('string field'), blank=True, default='')
#     unicode_field = JSONField(_('unicode field'), blank=True, default=u'')
# 
# class MonthModel(models.Model):
#     """
#     Dummy model for testing ``MonthModel`` fields.
#     """
#     default_month = MonthField(_('default month'), default=TODAY)
#     first_month = MonthField(_('first month'))
#     last_month = MonthField(_('last month'), blank=True, null=True)
# 
# class PickleModel(models.Model):
#     """
#     Dummy model for testing ``PickleField`` fields.
#     """
#     bool_field = PickleField(_('bool field'), blank=True, default=True)
#     dict_field = PickleField(_('dict field'), blank=True, default={})
#     float_field = PickleField(_('float field'), blank=True, default=0.0)
#     int_field = PickleField(_('int field'), blank=True, default=0)
#     list_field = PickleField(_('list field'), blank=True, default=[])
#     long_field = PickleField(_('long field'), blank=True, default=0L)
#     none_field = PickleField(_('None field'), blank=True, default=None)
#     object_field = PickleField(_('object field'), blank=True,
#         default=DummyObject())
#     str_field = PickleField(_('string field'), blank=True, default='')
#     tuple_field = PickleField(_('tuple field'), blank=True, default=tuple())
#     unicode_field = PickleField(_('unicode field'), blank=True, default=u'')
# 
# class TimeDeltaModel(models.Model):
#     """
#     Dummy model for testing ``TimeDeltaField`` fields.
#     """
#     total_time = TimeDeltaField()
#     average_total_time = TimeDeltaField(blank=True, null=True)


import datetime
import os
import shutil
import sys
from random import randint
from StringIO import StringIO
from django.conf import settings
from django.contrib.auth.models import User
from django.core.management import call_command
from django.test import TestCase
from testproject.db.models import DummyObject, JSONModel, MonthModel, \
    PickleModel, TimeDeltaModel
        ('2 days, 1:11:00', datetime.timedelta(seconds=177060)),
        (datetime.timedelta(hours=72, minutes=30),
         datetime.timedelta(seconds=261000)),
        (129600, datetime.timedelta(seconds=129600)),
    ),
    'filled': (
        (('72:00', '72:00'), (datetime.timedelta(seconds=259200),
                              datetime.timedelta(seconds=259200))),
        (('1 day, 11:39:00', '1 day, 11:39:00'),
         (datetime.timedelta(seconds=128340),
          datetime.timedelta(seconds=128340))),
        (('2 days, 1:11:00', '2 days, 1:11:00'),
         (datetime.timedelta(seconds=177060),
          datetime.timedelta(seconds=177060))),
        ((datetime.timedelta(hours=72, minutes=30),
          datetime.timedelta(hours=72, minutes=30)),
         (datetime.timedelta(seconds=261000),
          datetime.timedelta(seconds=261000))),
        ((129600, 129600), (datetime.timedelta(seconds=129600),
                            datetime.timedelta(seconds=129600))),
    ),
}

TODAY = datetime.date.today


class TestJSONField(TestCase):

    def check(self, field, value, create=False, delete=False, exists=None):
        field = '%s_field' % field

# Path: testproject/db/models.py
# class DummyObject(object):
#     """
#     Dummy object for storing in pickle field.
#     """
#     def __eq__(self, other):
#         return type(self) == type(other)
# 
# class JSONModel(models.Model):
#     """
#     Dummy model for testing ``JSONField`` fields.
#     """
#     bool_field = JSONField(_('bool field'), blank=True, default=True)
#     dict_field = JSONField(_('dict field'), blank=True, default={})
#     float_field = JSONField(_('float field'), blank=True, default=0.0)
#     int_field = JSONField(_('int field'), blank=True, default=0)
#     list_field = JSONField(_('list field'), blank=True, default=[])
#     none_field = JSONField(_('None field'), blank=True, default=None)
#     str_field = JSONField(_('string field'), blank=True, default='')
#     unicode_field = JSONField(_('unicode field'), blank=True, default=u'')
# 
# class MonthModel(models.Model):
#     """
#     Dummy model for testing ``MonthModel`` fields.
#     """
#     default_month = MonthField(_('default month'), default=TODAY)
#     first_month = MonthField(_('first month'))
#     last_month = MonthField(_('last month'), blank=True, null=True)
# 
# class PickleModel(models.Model):
#     """
#     Dummy model for testing ``PickleField`` fields.
#     """
#     bool_field = PickleField(_('bool field'), blank=True, default=True)
#     dict_field = PickleField(_('dict field'), blank=True, default={})
#     float_field = PickleField(_('float field'), blank=True, default=0.0)
#     int_field = PickleField(_('int field'), blank=True, default=0)
#     list_field = PickleField(_('list field'), blank=True, default=[])
#     long_field = PickleField(_('long field'), blank=True, default=0L)
#     none_field = PickleField(_('None field'), blank=True, default=None)
#     object_field = PickleField(_('object field'), blank=True,
#         default=DummyObject())
#     str_field = PickleField(_('string field'), blank=True, default='')
#     tuple_field = PickleField(_('tuple field'), blank=True, default=tuple())
#     unicode_field = PickleField(_('unicode field'), blank=True, default=u'')
# 
# class TimeDeltaModel(models.Model):
#     """
#     Dummy model for testing ``TimeDeltaField`` fields.
#     """
#     total_time = TimeDeltaField()
#     average_total_time = TimeDeltaField(blank=True, null=True)


# Path: testproject/db/tests.py
import datetime
import os
import shutil
import sys
from random import randint
from StringIO import StringIO
from django.conf import settings
from django.contrib.auth.models import User
from django.core.management import call_command
from django.test import TestCase
from testproject.db.models import DummyObject, JSONModel, MonthModel, \
    PickleModel, TimeDeltaModel

        ('2 days, 1:11:00', datetime.timedelta(seconds=177060)),
        (datetime.timedelta(hours=72, minutes=30),
         datetime.timedelta(seconds=261000)),
        (129600, datetime.timedelta(seconds=129600)),
    ),
    'filled': (
        (('72:00', '72:00'), (datetime.timedelta(seconds=259200),
                              datetime.timedelta(seconds=259200))),
        (('1 day, 11:39:00', '1 day, 11:39:00'),
         (datetime.timedelta(seconds=128340),
          datetime.timedelta(seconds=128340))),
        (('2 days, 1:11:00', '2 days, 1:11:00'),
         (datetime.timedelta(seconds=177060),
          datetime.timedelta(seconds=177060))),
        ((datetime.timedelta(hours=72, minutes=30),
          datetime.timedelta(hours=72, minutes=30)),
         (datetime.timedelta(seconds=261000),
          datetime.timedelta(seconds=261000))),
        ((129600, 129600), (datetime.timedelta(seconds=129600),
                            datetime.timedelta(seconds=129600))),
    ),
}

TODAY = datetime.date.today


class TestJSONField(TestCase):

    def check(self, field, value, create=False, delete=False, exists=None):
        field = '%s_field' % field

        klass = JSONModel