# 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
        obj = self.check('int', second, exists=obj)
        self.check('int', third, exists=obj, delete=True)

    def test_list_value(self):
        first, second = [1, 2, 3, 'a', 'b', 'c'], [26, 25, 24, 'z', 'y', 'x']

        obj = self.check('list', first, create=True)
        self.check('list', second, exists=obj, delete=True)

    def test_long_value(self):
        first, second, third = -1L, 0L, 1L

        obj = self.check('long', first, create=True)
        obj = self.check('long', second, exists=obj)
        self.check('long', third, exists=obj, delete=True)

    def test_object_value(self):
        first = DummyObject()
        second = User.objects.create_user(username=USERNAME,
                                          password=PASSWORD,
                                          email=EMAIL)
        third = JSONModel.objects.create()

        obj = self.check('object', first, create=True)
        obj = self.check('object', second, exists=obj)
        obj = self.check('object', third, exists=obj)

        # Make sure that Django model does not convert to PK after model
        # update
        obj.save()

# 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

        obj = self.check('int', second, exists=obj)
        self.check('int', third, exists=obj, delete=True)

    def test_list_value(self):
        first, second = [1, 2, 3, 'a', 'b', 'c'], [26, 25, 24, 'z', 'y', 'x']

        obj = self.check('list', first, create=True)
        self.check('list', second, exists=obj, delete=True)

    def test_long_value(self):
        first, second, third = -1L, 0L, 1L

        obj = self.check('long', first, create=True)
        obj = self.check('long', second, exists=obj)
        self.check('long', third, exists=obj, delete=True)

    def test_object_value(self):
        first = DummyObject()
        second = User.objects.create_user(username=USERNAME,
                                          password=PASSWORD,
                                          email=EMAIL)
        third = JSONModel.objects.create()

        obj = self.check('object', first, create=True)
        obj = self.check('object', second, exists=obj)
        obj = self.check('object', third, exists=obj)

        # Make sure that Django model does not convert to PK after model
        # update
        obj.save()

        obj = PickleModel.objects.get()