예제 #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'))
예제 #2
0
class TestFeel(unittest.TestCase):
    def setUp(self):
        self.unit = mock.Mock()
        self.unit.say.return_value = None
        self.feel = Feel(self.unit)

    def test_should_get_object_at_position_from_offset(self):
        self.unit.position.relative_space.return_value = [1, 0]
        self.feel.perform('forward')
        self.unit.position.relative_space.assert_called_once_with(1, 0)
예제 #3
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'))
예제 #4
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})
예제 #5
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})
예제 #6
0
 def setUp(self):
     self.unit = mock.Mock()
     self.unit.say.return_value = None
     self.feel = Feel(self.unit)