... estCase ( TestCase ): def setUp ( self ): Animal . objects . create ( name = "cat" , sound = "meow" ) def test_animals_can_speak ( self ): """Animals that can speak are correctly identified""" cat = Animal . objects . get ( name = "cat" ) self . asser ... tEqual ( cat . speak (), 'The cat says "meow"' ) cat . sound = "hiss" cat . save ( update_fields = [ "sound" ]) self . assertEqual ( cat . spea ... t animals.tests.AnimalTestCase # Run just one test method $ ./manage.py test animals.tests.AnimalTestCase.test_animals_can_speak ディレクトリ下に置かれたテストを探索するために、ディレクトリのパスを指定することもできます。 $ ./manage.py test animals/ - ... ... estCase ( TestCase ): def setUp ( self ): Animal . objects . create ( name = "cat" , sound = "meow" ) def test_animals_can_speak ( self ): """Animals that can speak are correctly identified""" cat = Animal . objects . get ( name = "cat" ) self . asser ... tEqual ( cat . speak (), 'The cat says "meow"' ) cat . sound = "hiss" cat . save ( update_fields = [ "sound" ]) self . assertEqual ( cat . spea ... t animals.tests.AnimalTestCase # Run just one test method $ ./manage.py test animals.tests.AnimalTestCase.test_animals_can_speak ディレクトリ下に置かれたテストを探索するために、ディレクトリのパスを指定することもできます。 $ ./manage.py test animals/ - ... 2026年10月08日