# Path: dplace_app/models.py
# class Society(models.Model):
#     class Meta(object):
# class SocietyRelation(models.Model):
# class Category(models.Model):
#     class Meta(object):
# class Variable(models.Model):
#     class Meta(object):
# class CodeDescription(models.Model):
#     class Meta(object):
# class Value(models.Model):
#     class Meta(object):
# class Source(models.Model):
#     class Meta(object):
# class LanguageFamily(models.Model):
#     class Meta(object):
# class Language(models.Model):
#     class Meta(object):
# class GeographicRegion(models.Model):
#     class Meta(object):
# class LanguageTree(models.Model):
#     class Meta(object):
# class LanguageTreeLabels(models.Model):
#     class Meta:
# class LanguageTreeLabelsSequence(models.Model):
#     class Meta:
#     def related(self):
#     def location(self):
#     def original_location(self):
#     def get_environmental_data(self):
#     def get_cultural_trait_data(self):
#     def get_data_references(self):
#     def __unicode__(self):
#     def get_absolute_url(self):
#     def __unicode__(self):
#     def coded_societies(self):
#     def __unicode__(self):
#     def save(self, *args, **kwargs):
#     def read_code_number(self):
#     def coded_societies(self):
#     def __unicode__(self):
#     def get_description(self):
#     def __unicode__(self):
#     def __unicode__(self):
#     def __unicode__(self):
#     def get_absolute_url(self):
#     def __unicode__(self):


from django.test import TestCase
from dplace_app import models

    def test_coded_variable(self):
        self.assertEqual(self.code1.variable, self.variable)
        self.assertEqual(self.code2.variable, self.variable)

    def test_society_variable(self):
        self.assertIn(self.ea_society, self.variable.coded_societies())
        self.assertNotIn(self.binford_society, self.variable.coded_societies())

    def test_society_code(self):
        self.assertIn(self.ea_society, self.code1.coded_societies())
        self.assertNotIn(self.ea_society, self.code2.coded_societies())

    def test_code_order(self):
        """
        Make sure 2 comes before 10
        """
        index_of_2 = index_of_10 = index = 0
        for code in self.variable.codes.all():
            if code == self.code2:
                index_of_2 = index
            elif code == self.code10:
                index_of_10 = index
            index += 1
        self.assertLess(index_of_2, index_of_10)
    
    def test_get_description(self):
        assert self.value.get_description() == self.value.code.description
    
    def test_get_description_no_code(self):

# Path: dplace_app/models.py
# class Society(models.Model):
#     class Meta(object):
# class SocietyRelation(models.Model):
# class Category(models.Model):
#     class Meta(object):
# class Variable(models.Model):
#     class Meta(object):
# class CodeDescription(models.Model):
#     class Meta(object):
# class Value(models.Model):
#     class Meta(object):
# class Source(models.Model):
#     class Meta(object):
# class LanguageFamily(models.Model):
#     class Meta(object):
# class Language(models.Model):
#     class Meta(object):
# class GeographicRegion(models.Model):
#     class Meta(object):
# class LanguageTree(models.Model):
#     class Meta(object):
# class LanguageTreeLabels(models.Model):
#     class Meta:
# class LanguageTreeLabelsSequence(models.Model):
#     class Meta:
#     def related(self):
#     def location(self):
#     def original_location(self):
#     def get_environmental_data(self):
#     def get_cultural_trait_data(self):
#     def get_data_references(self):
#     def __unicode__(self):
#     def get_absolute_url(self):
#     def __unicode__(self):
#     def coded_societies(self):
#     def __unicode__(self):
#     def save(self, *args, **kwargs):
#     def read_code_number(self):
#     def coded_societies(self):
#     def __unicode__(self):
#     def get_description(self):
#     def __unicode__(self):
#     def __unicode__(self):
#     def __unicode__(self):
#     def get_absolute_url(self):
#     def __unicode__(self):


# Path: dplace_app/tests/test_models.py
from django.test import TestCase
from dplace_app import models


    def test_coded_variable(self):
        self.assertEqual(self.code1.variable, self.variable)
        self.assertEqual(self.code2.variable, self.variable)

    def test_society_variable(self):
        self.assertIn(self.ea_society, self.variable.coded_societies())
        self.assertNotIn(self.binford_society, self.variable.coded_societies())

    def test_society_code(self):
        self.assertIn(self.ea_society, self.code1.coded_societies())
        self.assertNotIn(self.ea_society, self.code2.coded_societies())

    def test_code_order(self):
        """
        Make sure 2 comes before 10
        """
        index_of_2 = index_of_10 = index = 0
        for code in self.variable.codes.all():
            if code == self.code2:
                index_of_2 = index
            elif code == self.code10:
                index_of_10 = index
            index += 1
        self.assertLess(index_of_2, index_of_10)
    
    def test_get_description(self):
        assert self.value.get_description() == self.value.code.description
    
    def test_get_description_no_code(self):

        obj = models.Value.objects.create(