# Path: arangodb/orm/fields.py
# class DateField(ModelField):
# 
#     DATE_FORMAT = '%Y-%m-%d'
# 
#     def __init__(self, **kwargs):
#         """
#         """
# 
#         super(DateField, self).__init__(**kwargs)
# 
#         if self.null and not self.default:
#             self.date = None
#         else:
#             if self.default:
#                 self.date = self.default
#             else:
#                 self.date = date.today()
# 
#     def dumps(self):
#         """
#         """
# 
#         if self.null and self.date is None:
#             return None
#         else:
#             if self.date is None:
#                 raise Exception('Datetime cannot be None')
#             else:
#                 return '%s' % self.date.strftime(DateField.DATE_FORMAT)
# 
#     def loads(self, date_string):
#         """
#         """
# 
#         if not self.null:
#             self.date = datetime.strptime(date_string, DateField.DATE_FORMAT)
#         else:
#             self.date = None
# 
#     def validate(self):
#         """
#         """
# 
#     def set(self, *args, **kwargs):
#         """
#         """
# 
#         if len(args) is 1:
#             date = args[0]
#             if isinstance(args, six.string_types):
#                 self.loads(date)
#             else:
#                 self.date = date
# 
#     def get(self):
#         """
#         """
# 
#         return self.date
# 
#     def __eq__(self, other):
#         """
#         """
# 
#         if super(DateField, self).__eq__(other):
#             return self.date == other.date
#         else:
#             return False


import unittest
import datetime
from arangodb.orm.fields import DateField



class DateFieldTestCase(unittest.TestCase):

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_basic_creation_with_default(self):
        date = datetime.date.today()

# Path: arangodb/orm/fields.py
# class DateField(ModelField):
# 
#     DATE_FORMAT = '%Y-%m-%d'
# 
#     def __init__(self, **kwargs):
#         """
#         """
# 
#         super(DateField, self).__init__(**kwargs)
# 
#         if self.null and not self.default:
#             self.date = None
#         else:
#             if self.default:
#                 self.date = self.default
#             else:
#                 self.date = date.today()
# 
#     def dumps(self):
#         """
#         """
# 
#         if self.null and self.date is None:
#             return None
#         else:
#             if self.date is None:
#                 raise Exception('Datetime cannot be None')
#             else:
#                 return '%s' % self.date.strftime(DateField.DATE_FORMAT)
# 
#     def loads(self, date_string):
#         """
#         """
# 
#         if not self.null:
#             self.date = datetime.strptime(date_string, DateField.DATE_FORMAT)
#         else:
#             self.date = None
# 
#     def validate(self):
#         """
#         """
# 
#     def set(self, *args, **kwargs):
#         """
#         """
# 
#         if len(args) is 1:
#             date = args[0]
#             if isinstance(args, six.string_types):
#                 self.loads(date)
#             else:
#                 self.date = date
# 
#     def get(self):
#         """
#         """
# 
#         return self.date
# 
#     def __eq__(self, other):
#         """
#         """
# 
#         if super(DateField, self).__eq__(other):
#             return self.date == other.date
#         else:
#             return False


# Path: arangodb/tests/orm/fields/date_field.py
import unittest
import datetime
from arangodb.orm.fields import DateField




class DateFieldTestCase(unittest.TestCase):

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_basic_creation_with_default(self):
        date = datetime.date.today()

        field = DateField(default=date)