text: from django.test import TestCase
  
  from catalog.models import Author
  
  class AuthorModelTest(TestCase):
  
      @classmethod
      def setUpTestData(cls):
          # Set up non-modified objects used by all test methods
          Author.objects.create(first_name='Big', last_name='Bob')
  
      def test_first_name_label(self):
          author = Author.objects.get(id=1)
          # NOTE: We can't get the verbose_name directly using author.first_name.verbose_name, 
          #       because author.first_name is a string.
          field_label = author._meta.get_field('first_name'). verbose_name
          # By default, Django does not capitalize the first letter of the label.
          self.assertEquals(field_label, 'first name')
          # NOTE: Why does assertEquals (with 's') work? Is that an alias for assertEqual?
  
      def test_date_of_death_label(self):
          author = Author.objects.get(id=1)
          field_label = author._meta.get_field('date_of_death').verbose_name
          self.assertEquals(field_label, 'Died')
  
      def test_first_name_max_length(self):
          author = Author.objects.get(id=1)
          max_length = author._meta.get_field('first_name').max_length
          self.assertEquals(max_length, 100)
  
      # Stefan:
      def test_last_name_label(self):
          author = Author.objects.get(id=1)
          last_name_label = author._meta.get_field('last_name').verbose_name
          self.assertEquals(last_name_label, 'last name')
  
      def test_date_of_birth_label(self):
          author = Author.objects.get(id=1)
          field_label = author._meta.get_field('date_of_birth').verbose_name
          self.assertEquals(field_label, 'date of birth')
  
      def test_last_name_max_lenth(self):
          author = Author.objects.get(id=1)
          field_max_length = author._meta.get_field('last_name').max_length
          self.assertEquals(field_max_length, 100)
      # =========================
  
      def test_object_name_is_last_name_comma_first_name(self):
          author = Author.objects.get(id=1)
          expected_object_name = '%s, %s' % (author.last_name, author.first_name)
          self.assertEquals(expected_object_name, str(author))
  
      def test_get_absolute_url(self):
          author = Author.objects.get(id=1)
          # This will also fail if the urlconf is not defined.
          self.assertEquals(author.get_absolute_url(), '/catalog/author/1')