def test_set_damage_negative_value_raises(self): a = MagicCard("Test") with self.assertRaises(ValueError): a.damage_points = -10
def test_damage_point_raise_exemption_when_less_than_0(self): with self.assertRaises(Exception) as ex: magic_card = MagicCard('test') magic_card.damage_points = -5 self.assertIsNotNone(ex.exception)
def test_damage_raises(self): card = MagicCard('test') with self.assertRaises(ValueError) as ex: card.damage_points = -100 self.assertEqual(str(ex.exception), "Card's damage points cannot be less than zero.")
def test_damage_setter(self): card = MagicCard('test') card.damage_points = 15 self.assertEqual(15, card.damage_points)
def test_damage_points_invalid_data_should_raise_error(self): card = MagicCard("TestCard") with self.assertRaises(ValueError): card.damage_points = -1
def test_damage_points_valid_data_should_work_correctly(self): card = MagicCard("TestCard") card.damage_points = 8 self.assertEqual(card.damage_points, 8)
def test_damage_setter_with_correct_number_should_change_damage(self): mg = MagicCard("It's some kind of magic...") mg.damage_points = 10 self.assertEqual(mg.damage_points, 10)
def tests_damage_setter_with_negative_number_should_raise_error(self): mg = MagicCard("It's some kind of magic...") with self.assertRaises(ValueError) as cm: mg.damage_points = -5 self.assertEqual(str(cm.exception), "Card's damage points cannot be less than zero.")
def test_add_damage_points(self): new_card = MagicCard("KOZA") new_card.damage_points = 62 self.assertEqual(new_card.damage_points, 62)