Exemple #1
0
 def setUp(self):
     self.floor = Floor()
     self.floor.width = 2
     self.floor.height = 3
     self.warrior = Warrior()
     self.floor.add(self.warrior, 0, 0)
     self.listen = Listen(self.warrior)
Exemple #2
0
    def test_should_print_map_with_stairs_and_unit(self):
        self.floor.add(Warrior(), 0, 0)
        self.floor.place_stairs(2, 0)
        self.assertEqual(self.floor.character, ''' ---
|@ >|
 ---
''')
Exemple #3
0
 def test_should_fetch_other_units_not_warrior(self):
     unit = UnitBase()
     warrior = Warrior()
     self.floor.add(unit, 0, 0, 'north')
     self.floor.add(warrior, 1, 0, 'north')
     self.assertNotIn(warrior, self.floor.other_units())
     self.assertIn(unit, self.floor.other_units())
Exemple #4
0
 def test_prepare_turn_and_play_turn_each_object_specified_amount(self):
     unit = Warrior()
     unit.prepare_turn = mock.Mock()
     unit.perform_turn = mock.Mock()
     self.floor.add(unit, 0, 0, 'north')
     self.level.play(2)
     unit.prepare_turn.assert_called_with()
     unit.perform_turn.assert_called_with()
     self.assertEqual(2, unit.prepare_turn.call_count)
     self.assertEqual(2, unit.perform_turn.call_count)
    def setUp(self):
        self.floor = Floor()
        self.floor.width = 4
        self.floor.height = 3
        self.warrior = Warrior()
        self.warrior._health = 20
        self.detonate = Detonate(self.warrior)

        self.target = UnitBase()
        self.target._health = 10

        self.floor.add(self.warrior, 0, 1, 'east')
 def warrior(self, *args, **kwargs):
     a_func = kwargs.get('func', None)
     warrior = Warrior(self.level)
     return self.level.setup_warrior(self.unit(warrior, *args, func=a_func))
Exemple #7
0
 def setUp(self):
     self.warrior = Warrior()
 def setUp(self):
     self.warrior = Warrior()
     self.rescue = Rescue(self.warrior)
 def setUp(self):
     self.warrior = Warrior()
     self.health = Health(self.warrior)
Exemple #10
0
 def test_should_consider_passed_When_warrior_is_on_stairs(self):
     self.level.warrior = Warrior()
     self.floor.add(self.level.warrior, 0, 0, 'north')
     self.floor.place_stairs(0, 0)
     self.assertTrue(self.level.is_passed())
Exemple #11
0
 def test_should_return_immediately_when_passed(self):
     unit = Warrior()
     unit.turn = mock.Mock()
     self.floor.add(unit, 0, 0, 'north')
     self.level.is_passed = mock.Mock(return_value=True)
     self.level.play(2)
Exemple #12
0
 def setUp(self):
     self.warrior = Warrior()
     self.rest = Rest(self.warrior)
Exemple #13
0
 def setUp(self):
     super(TestWithWarrior, self).setUp()
     warrior = Warrior()
     self.floor.add(warrior, 0, 0)
     self.space = self.floor.space(0, 0)