Closed infyloop closed 11 years ago
That should be:
def setUp(self):
self.author = G(Author)
self.book = G(Book, author=[author])
:-)
thanks, corrected :-)
DDF help to decrease the number of lines in setUp methods. A good unit test is a cohesive test. Avoid spread information of the test in many methods/classes.
PS: Django test suite let the tearDown method pratically useless. Just in very special scenarios it will be useful. DDF FileSystemTestCase has the same reason to exist.
Currently the documentation does not talk of how setUp and tearDown methods for classes work. If possible, include optimization of setUp and tearDown as well.
A simple example would be as follows: