from django.test import TestCase

from django_tablib import ModelDataset, Field

from .models import TestModel


class DjangoTablibTestCase(TestCase):
    def test_declarative_fields(self):
        class TestModelDataset(ModelDataset):
            field1 = Field()
            field2 = Field(attribute='field1')

            class Meta:
                model = TestModel

        data = TestModelDataset()

        self.assertEqual(len(data.headers), 2)
        self.assertTrue('id' not in data.headers)
        self.assertTrue('field1' in data.headers)
        self.assertTrue('field2' in data.headers)

@@ -144,16 +144,87 @@
 tCase):%0A
+    def setUp(self):%0A        TestModel.objects.create(field1='value')%0A%0A
     def 
@@ -652,24 +652,74 @@
 ield2' in data.headers)%0A
+%0A        self.assertEqual(data%5B0%5D%5B0%5D, data%5B0%5D%5B1%5D)%0A

Test that declarative fields actually work.