Ejemplo n.º 1
0
class TestTurnWithSenses(unittest.TestCase):
    def setUp(self):
        with mock.patch('pythonwarrior.abilities.feel.Feel.space', mock.Mock()):
            self.feel = Feel(mock.Mock())
            self.turn = Turn({'feel': self.feel})

    def test_should_be_able_to_call_sense_with_any_argument_and_return_expected_results(self):
        self.assertEqual(self.turn.feel(), self.feel.perform())
        self.assertEqual(self.turn.feel('backward'), self.feel.perform('backward'))
Ejemplo n.º 2
0
class TestTurnWithSenses(unittest.TestCase):
    def setUp(self):
        with mock.patch('pythonwarrior.abilities.feel.Feel.space',
                        mock.Mock()):
            self.feel = Feel(mock.Mock())
            self.turn = Turn({'feel': self.feel})

    def test_call_sense_with_any_argument_and_return_expected_results(self):
        self.assertEqual(self.turn.feel(), self.feel.perform())
        self.assertEqual(self.turn.feel('backward'),
                         self.feel.perform('backward'))
Ejemplo n.º 3
0
class TestTurnWithActions(unittest.TestCase):
    def setUp(self):
        self.turn = Turn({'walk_': None, 'attack_': None})

    def test_should_have_no_action_performed_at_first(self):
        self.assertIsNone(self.turn.action)

    def test_should_be_able_to_perform_action_and_recall_it(self):
        self.turn.walk_()
        self.assertEqual(self.turn.action, ['walk_'])

    def test_should_include_arguments_passed_to_action(self):
        self.turn.walk_('forward')
        self.assertEqual(self.turn.action, ['walk_', 'forward'])

    def test_should_not_be_able_to_call_multiple_actions_per_turn(self):
        self.turn.walk_('forward')
        self.assertRaises(Exception, self.turn.attack_)
Ejemplo n.º 4
0
class TestTurnWithActions(unittest.TestCase):
    def setUp(self):
        self.turn = Turn({'walk_': None, 'attack_': None})

    def test_should_have_no_action_performed_at_first(self):
        self.assertIsNone(self.turn.action)

    def test_should_be_able_to_perform_action_and_recall_it(self):
        self.turn.walk_()
        self.assertEqual(self.turn.action, ['walk_'])

    def test_should_include_arguments_passed_to_action(self):
        self.turn.walk_('forward')
        self.assertEqual(self.turn.action, ['walk_', 'forward'])

    def test_should_not_be_able_to_call_multiple_actions_per_turn(self):
        self.turn.walk_('forward')
        self.assertRaises(Exception, self.turn.attack_)
Ejemplo n.º 5
0
 def next_turn(self):
     return Turn(self.abilities)
Ejemplo n.º 6
0
 def setUp(self):
     self.turn = Turn({'walk_': None, 'attack_': None})
Ejemplo n.º 7
0
 def setUp(self):
     with mock.patch('pythonwarrior.abilities.feel.Feel.space', mock.Mock()):
         self.feel = Feel(mock.Mock())
         self.turn = Turn({'feel': self.feel})
Ejemplo n.º 8
0
 def setUp(self):
     self.turn = Turn({'walk_': None, 'attack_': None})
Ejemplo n.º 9
0
 def setUp(self):
     with mock.patch('pythonwarrior.abilities.feel.Feel.space',
                     mock.Mock()):
         self.feel = Feel(mock.Mock())
         self.turn = Turn({'feel': self.feel})