Пример #1
0
 def test_tuple_assignment(self):
     """Establish that we can assign composite fields by tuple as shown
     in the example documentation.
     """
     hobbit = Book(title='The Hobbit', date_published=date(1937, 9, 21))
     hobbit.author = ('J.R.R. Tolkien', 'male', date(1892, 1, 3))
     hobbit.save()
Пример #2
0
 def test_tuple_assignment(self):
     """Establish that we can assign composite fields by tuple as shown
     in the example documentation.
     """
     hobbit = Book(title='The Hobbit', date_published=date(1937, 9, 21))
     hobbit.author = ('J.R.R. Tolkien', 'male', date(1892, 1, 3))
     hobbit.save()
Пример #3
0
 def test_instance_class_assignment_by_field_access(self):
     """Establish that we can assign composite fields using the
     CompositeField.instance_class paradigm.
     """
     hobbit = Book(title='The Hobbit', date_published=date(1937, 9, 21))
     hobbit.author = AuthorField.instance_class(
         birthdate=date(1892, 1, 3),
         name='J.R.R. Tolkien',
         sex='male',
     )
     hobbit.save()
Пример #4
0
 def test_instance_class_assignment_by_field_access(self):
     """Establish that we can assign composite fields using the
     CompositeField.instance_class paradigm.
     """
     hobbit = Book(title='The Hobbit', date_published=date(1937, 9, 21))
     hobbit.author = AuthorField.instance_class(
         birthdate=date(1892, 1, 3),
         name='J.R.R. Tolkien',
         sex='male',
     )
     hobbit.save()
Пример #5
0
 def test_instance_class_assignment_by_module_access(self):
     """Establish that we can assign composite fields using the
     paradigm of pulling the composite instance subclass from the same
     module.
     """
     hobbit = Book(title='The Hobbit', date_published=date(1937, 9, 21))
     hobbit.author = Author(
         birthdate=date(1892, 1, 3),
         name='J.R.R. Tolkien',
         sex='male',
     )
     hobbit.save()
Пример #6
0
 def test_instance_class_assignment_by_module_access(self):
     """Establish that we can assign composite fields using the
     paradigm of pulling the composite instance subclass from the same
     module.
     """
     hobbit = Book(title='The Hobbit', date_published=date(1937, 9, 21))
     hobbit.author = Author(
         birthdate=date(1892, 1, 3),
         name='J.R.R. Tolkien',
         sex='male',
     )
     hobbit.save()