class TestGangsterBoss(TestCase): def setUp(self): self.g = Gangster('Gangster', 15) self.gb = Gangster('Gangster Boss', 75) self.g.set_boss(self.gb) def test_has_boss_on_newly_created_gangster_return_false(self): g = Gangster('Gang', 12) self.assertFalse(g.has_boss()) def test_set_boss_throws_error_on_not_gangster_instance(self): self.assertRaises(Exception, self.g.set_boss, 'gigi') def test_set_boss_accepts_none(self): self.assertTrue(self.g.set_boss(None)) def test_set_boss_updates_the_gangster_boss(self): self.assertTrue(self.g.has_boss()) def test_get_boss_returns_gangster_boss(self): self.assertEquals(self.g.get_boss(), self.gb)
def test_has_boss_on_newly_created_gangster_return_false(self): g = Gangster('Gang', 12) self.assertFalse(g.has_boss())