Exemple #1
0
 def test_survive_if_take_less_damaga_than_hp(self):
     test_b = Building(surface="surface", position=(10, 10), hp=100, size=20)
     test_b.take_damage(50)
     self.assertFalse(test_b.is_dead())
Exemple #2
0
 def test_if_building_position_is_tuple(self):
     test_b = Building(surface="surface", position=(10, 10), hp=100, size=20)
     self.assertTrue(test_b.get_position() == (10, 10))
Exemple #3
0
 def test_die_if_take_more_damaga_than_hp(self):
     test_b = Building(surface="surface", position=(10, 10), hp=100, size=20)
     test_b.take_damage(150)
     self.assertTrue(test_b.is_dead())
Exemple #4
0
 def test_size_is_string_throw_exception(self):
     with self.assertRaises(TypeError) as context:
         Building(surface="surface", position=(5, '2'), hp=100, size=20)
     self.assertTrue(str(context.exception))
Exemple #5
0
 def test_size_is_float_throw_exception(self):
     with self.assertRaises(TypeError) as context:
         Building(surface="surface", position=(5, 2), hp=1, size=2.4)
     self.assertTrue(str(context.exception))
Exemple #6
0
 def test_hp_is_float_throw_exception(self):
     with self.assertRaises(TypeError) as context:
         Building(surface="surface", position=(2.3, 10), hp=1.5, size=20)
     self.assertTrue(str(context.exception))
Exemple #7
0
 def test_y_position_is_integer(self):
     test_b = Building(surface="surface", position=(10, 10), hp=100, size=20)
     y_position = test_b.get_position()[1]
     self.assertTrue(isinstance(y_position, int))