# 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

    def test_bool_value(self):
        first, second = True, False

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

    def test_default_values(self):
        obj = PickleModel.objects.create()

        self.assertTrue(obj.bool_field)
        self.assertEqual(obj.dict_field, {})
        self.assertEqual(obj.float_field, 0.0)
        self.assertEqual(obj.int_field, 0)
        self.assertEqual(obj.list_field, [])
        self.assertEqual(obj.long_field, 0L)
        self.assertEqual(obj.object_field, DummyObject())
        self.assertEqual(obj.str_field, '')
        self.assertEqual(obj.tuple_field, tuple())
        self.assertEqual(obj.unicode_field, u'')

        obj.delete()

    def test_dict_value(self):
        first, second = {'a': 1, 'b': 2, 'c': 3}, {'z': 26, 'y': 25, 'x': 24}

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

    def test_dummy_object(self):

# 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


    def test_bool_value(self):
        first, second = True, False

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

    def test_default_values(self):
        obj = PickleModel.objects.create()

        self.assertTrue(obj.bool_field)
        self.assertEqual(obj.dict_field, {})
        self.assertEqual(obj.float_field, 0.0)
        self.assertEqual(obj.int_field, 0)
        self.assertEqual(obj.list_field, [])
        self.assertEqual(obj.long_field, 0L)
        self.assertEqual(obj.object_field, DummyObject())
        self.assertEqual(obj.str_field, '')
        self.assertEqual(obj.tuple_field, tuple())
        self.assertEqual(obj.unicode_field, u'')

        obj.delete()

    def test_dict_value(self):
        first, second = {'a': 1, 'b': 2, 'c': 3}, {'z': 26, 'y': 25, 'x': 24}

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

    def test_dummy_object(self):

        self.assertEqual(DummyObject(), DummyObject())