Ticket #17364: testing.txt.2.diff
File testing.txt.2.diff, 1.3 KB (added by , 13 years ago) |
---|
-
docs/topics/testing.txt
85 85 :mod:`django.utils.unittest` module alias. If you are using Python 86 86 2.7, or you have installed unittest2 locally, Django will map the 87 87 alias to the installed version of the unittest library. Otherwise, 88 Django will use it 's own bundled version of unittest2.88 Django will use its own bundled version of unittest2. 89 89 90 90 To use this alias, simply use:: 91 91 … … 120 120 self.lion = Animal.objects.create(name="lion", sound="roar") 121 121 self.cat = Animal.objects.create(name="cat", sound="meow") 122 122 123 def testSpeaking(self): 123 def test_animals_can_speak(self): 124 """Animals that can speak are correctly identified""" 124 125 self.assertEqual(self.lion.speak(), 'The lion says "roar"') 125 126 self.assertEqual(self.cat.speak(), 'The cat says "meow"') 126 127 … … 288 289 method inside a test case, add the name of the test method to the 289 290 label:: 290 291 291 $ ./manage.py test animals.AnimalTestCase.test FluffyAnimals292 $ ./manage.py test animals.AnimalTestCase.test_animals_can_speak 292 293 293 294 .. versionadded:: 1.2 294 295 The ability to select individual doctests was added.