Exemplo n.º 1
0
 def test_set_health_negative_value_raises(self):
     a = MagicCard("Test")
     with self.assertRaises(ValueError):
         a.health_points = -10
Exemplo n.º 2
0
    def test_health_point_raise_exemption_when_less_than_0(self):
        with self.assertRaises(Exception) as ex:
            magic_card = MagicCard('test')
            magic_card.health_points = -5

        self.assertIsNotNone(ex.exception)
Exemplo n.º 3
0
 def test_health_raises(self):
     card = MagicCard('test')
     with self.assertRaises(ValueError) as ex:
         card.health_points = -100
     self.assertEqual(str(ex.exception), "Card's HP cannot be less than zero.")
Exemplo n.º 4
0
 def test_health_setter(self):
     card = MagicCard('test')
     card.health_points = 15
     self.assertEqual(15, card.health_points)
Exemplo n.º 5
0
    def test_health_points_invalid_data_should_raise_error(self):
        card = MagicCard("TestCard")

        with self.assertRaises(ValueError):
            card.health_points = -1
Exemplo n.º 6
0
    def test_health_points_valid_data_should_work_correctly(self):
        card = MagicCard("TestCard")
        card.health_points = 8

        self.assertEqual(card.health_points, 8)
Exemplo n.º 7
0
 def test_health_setter_with_correct_number_should_change_health(self):
     mg  = MagicCard("It's some kind of magic...")
     mg.health_points = 10
     self.assertEqual(mg.health_points, 10)
Exemplo n.º 8
0
 def tests_health_setter_with_negative_number_should_raise_error(self):
     mg  = MagicCard("It's some kind of magic...")
     with self.assertRaises(ValueError) as cm:
         mg.health_points = -5
     self.assertEqual(str(cm.exception), "Card's HP cannot be less than zero.")
Exemplo n.º 9
0
 def test_add_health_points(self):
     new_card = MagicCard("KOZA")
     new_card.health_points = 62
     self.assertEqual(new_card.health_points, 62)