# Path: lighty/db/backend.py
# class Datastore(object):
# class DatastoreManager(object):
#     def __init__(self, name, db_name, **kwargs):
#     def get(self, model, kwargs):
#     def put(self, model, item):
#     def delete(self, model, **kwargs):
#     def get_datastore_operation(operation, operand=None):
#     def process_operand(operand):
#     def build_query(query):
#     def query(self, query, fields=None):
#     def count(self, query):
#     def slice(self, query, limit=1, offset=0):
#     def __init__(self, default_name='default'):
#     def connect(self, name, **kwargs):
#     def get(self, name=None):
#     def default(self):
#     def swap(self, first_name, second_name=None):
# 
# Path: lighty/db/fields.py
# def add_validator(validator, options):
#     def __init__(self, verbose_name=None, primary_key=False, db_index=False,
#                        unique=False, blank=False, null=False, choices=None,
#                        default=None, editable=True, validators=(),
#                        help_text="", db_column=None, db_tablespace=False):
#     def configure(self, model_name, field_name):
#     def get_value_for_datastore(self, model):
#     def make_value_from_datastore(self, value):
#     def __str__(self, model=None):
#     def configure(self, model_name, field_name):
#     def __get__(self, instance, owner):
#     def __set__(self, instance, value):
#     def __init__(self, **options):
#     def __set__(self, instance, value):
#     def __init__(self, **options):
#     def __init__(self, **options):
#     def __set__(self, instance, value):
#     def __init__(self, max_digits=None, decimal_places=None, **options):
#     def __set__(self, instance, value):
#     def __init__(self, **options):
#     def __set__(self, instance, value):
#     def __init__(self, max_length=None, **options):
#     def __init__(self, max_length=75, **options):
#     def __init__(self, verify_exists=True, max_length=200, **options):
#     def __init__(self, **options):
#     def __init__(self, max_length=50, **options):
#     def __init__(self, auto_now=False, auto_now_add=False, **options):
#     def get_value_for_datastore(self, model):
#     def make_value_from_datastore(self, value):
#     def get_value_for_datastore(self, model):
#     def make_value_from_datastore(self, value):
#     def get_value_for_datastore(self, model):
#     def __init__(self, model, **kwargs):
#     def get_value_for_datastore(self, model):
#     def make_value_from_datastore(self, value):
# class Field(BaseField):
# class FieldDescriptor(Field):
# class IntegerField(FieldDescriptor, NumericField):
# class PositiveIntegerField(IntegerField):
# class AutoField(IntegerField):
# class FloatField(FieldDescriptor, NumericField):
# class DecimalField(Field, NumericField):
# class BooleanField(FieldDescriptor):
# class NullBooleanField(BooleanField):
# class CharField(Field, SequenceField):
# class EmailField(CharField):
# class URLField(CharField):
# class IPAddressField(Field):
# class SlugField(CharField):
# class DateField(Field, NumericField):
# class DateTimeField(DateField, NumericField):
# class TimeField(DateField, NumericField):
# class TextField(Field, SequenceField):
# class ForeignKey(Field):
# 
# Path: lighty/db/models.py
# def get_attr_source(name, cls):
#     def __new__(cls, name, bases, attrs):
#     def __init__(self, is_new=True, **kwds):
#     def datastore(cls):
#     def is_saved(self):
#     def key(self):
#     def put(self):
#     def delete(self):
#     def entity_name(cls):
#     def get(cls, _key=None, **keys):
#     def all(cls):
#     def fields(cls):
#     def validators(cls):
# class ModelBase(type):
# class Model(with_metaclass(ModelBase)):


import unittest
from lighty.db import backend, fields, models
'''Test case for MongoDB database backend
'''



class ModelTestCase(unittest.TestCase):
    '''Test case
    '''

    def testClassExtending(self):
        '''Test is child class inherit all the field from parent class
        '''
        class Base(models.Model):
            name = fields.CharField()

        class Child(Base):
            text = fields.TextField()

        assert 'name' in Child._fields, (
                        'Error on model class extending: %s' % Child._fields)
        assert isinstance(Child.name, fields.CharField), (
                        'Error on model class extending: %s' % Child.name)


class DatastoreTestCase(unittest.TestCase):
    '''Test case for datastore object
    '''
    class TestClass(models.Model):
        _datastore_name = 'test1'

# Path: lighty/db/backend.py
# class Datastore(object):
# class DatastoreManager(object):
#     def __init__(self, name, db_name, **kwargs):
#     def get(self, model, kwargs):
#     def put(self, model, item):
#     def delete(self, model, **kwargs):
#     def get_datastore_operation(operation, operand=None):
#     def process_operand(operand):
#     def build_query(query):
#     def query(self, query, fields=None):
#     def count(self, query):
#     def slice(self, query, limit=1, offset=0):
#     def __init__(self, default_name='default'):
#     def connect(self, name, **kwargs):
#     def get(self, name=None):
#     def default(self):
#     def swap(self, first_name, second_name=None):
# 
# Path: lighty/db/fields.py
# def add_validator(validator, options):
#     def __init__(self, verbose_name=None, primary_key=False, db_index=False,
#                        unique=False, blank=False, null=False, choices=None,
#                        default=None, editable=True, validators=(),
#                        help_text="", db_column=None, db_tablespace=False):
#     def configure(self, model_name, field_name):
#     def get_value_for_datastore(self, model):
#     def make_value_from_datastore(self, value):
#     def __str__(self, model=None):
#     def configure(self, model_name, field_name):
#     def __get__(self, instance, owner):
#     def __set__(self, instance, value):
#     def __init__(self, **options):
#     def __set__(self, instance, value):
#     def __init__(self, **options):
#     def __init__(self, **options):
#     def __set__(self, instance, value):
#     def __init__(self, max_digits=None, decimal_places=None, **options):
#     def __set__(self, instance, value):
#     def __init__(self, **options):
#     def __set__(self, instance, value):
#     def __init__(self, max_length=None, **options):
#     def __init__(self, max_length=75, **options):
#     def __init__(self, verify_exists=True, max_length=200, **options):
#     def __init__(self, **options):
#     def __init__(self, max_length=50, **options):
#     def __init__(self, auto_now=False, auto_now_add=False, **options):
#     def get_value_for_datastore(self, model):
#     def make_value_from_datastore(self, value):
#     def get_value_for_datastore(self, model):
#     def make_value_from_datastore(self, value):
#     def get_value_for_datastore(self, model):
#     def __init__(self, model, **kwargs):
#     def get_value_for_datastore(self, model):
#     def make_value_from_datastore(self, value):
# class Field(BaseField):
# class FieldDescriptor(Field):
# class IntegerField(FieldDescriptor, NumericField):
# class PositiveIntegerField(IntegerField):
# class AutoField(IntegerField):
# class FloatField(FieldDescriptor, NumericField):
# class DecimalField(Field, NumericField):
# class BooleanField(FieldDescriptor):
# class NullBooleanField(BooleanField):
# class CharField(Field, SequenceField):
# class EmailField(CharField):
# class URLField(CharField):
# class IPAddressField(Field):
# class SlugField(CharField):
# class DateField(Field, NumericField):
# class DateTimeField(DateField, NumericField):
# class TimeField(DateField, NumericField):
# class TextField(Field, SequenceField):
# class ForeignKey(Field):
# 
# Path: lighty/db/models.py
# def get_attr_source(name, cls):
#     def __new__(cls, name, bases, attrs):
#     def __init__(self, is_new=True, **kwds):
#     def datastore(cls):
#     def is_saved(self):
#     def key(self):
#     def put(self):
#     def delete(self):
#     def entity_name(cls):
#     def get(cls, _key=None, **keys):
#     def all(cls):
#     def fields(cls):
#     def validators(cls):
# class ModelBase(type):
# class Model(with_metaclass(ModelBase)):


# Path: tests/db.py
import unittest
from lighty.db import backend, fields, models

'''Test case for MongoDB database backend
'''



class ModelTestCase(unittest.TestCase):
    '''Test case
    '''

    def testClassExtending(self):
        '''Test is child class inherit all the field from parent class
        '''
        class Base(models.Model):
            name = fields.CharField()

        class Child(Base):
            text = fields.TextField()

        assert 'name' in Child._fields, (
                        'Error on model class extending: %s' % Child._fields)
        assert isinstance(Child.name, fields.CharField), (
                        'Error on model class extending: %s' % Child.name)


class DatastoreTestCase(unittest.TestCase):
    '''Test case for datastore object
    '''
    class TestClass(models.Model):
        _datastore_name = 'test1'

        name = fields.CharField()