Ejemplo n.º 1
0
 def test_commands_dictionary(self):
     test_commands = {}
     self.assertEqual(ActionManager.get_commands(), test_commands)
     self.reg_command_func(*self.reg_command_params)
     self.assertNotEqual(ActionManager.get_commands(), test_commands)
     test_commands["Test"] = None
     self.assertEqual(ActionManager.get_commands(), test_commands)
     ActionManager.clear_commands()
     test_commands = {}
     self.assertEqual(ActionManager.get_commands(), test_commands)
Ejemplo n.º 2
0
 def test_commands_dictionary(self):
     test_commands = {}
     self.assertEqual(ActionManager.get_commands(), test_commands)
     self.reg_command_func(*self.reg_command_params)
     self.assertNotEqual(ActionManager.get_commands(), test_commands)
     test_commands["Test"] = None
     self.assertEqual(ActionManager.get_commands(), test_commands)
     ActionManager.clear_commands()
     test_commands = {}
     self.assertEqual(ActionManager.get_commands(), test_commands)
Ejemplo n.º 3
0
    def execute(self):
        """Execute the action

        Raises:
            :class:`fife_rpg.exceptions.NoSuchCommandError`
            if a command is detected that is not registered.
        """
        # Check if there are special commands and execute them
        for command_data in self.commands:
            command = command_data["Command"]
            available_commands = ActionManager.get_commands()
            if command in available_commands:
                available_commands[command](command_data)
            else:
                raise NoSuchCommandError(command)
        self.executed = True
Ejemplo n.º 4
0
    def execute(self):
        """Execute the action

        Raises:
            :class:`fife_rpg.exceptions.NoSuchCommandError`
            if a command is detected that is not registered.
        """
        # Check if there are special commands and execute them
        for command_data in self.commands:
            command = command_data["Command"]
            available_commands = ActionManager.get_commands()
            if command in available_commands:
                available_commands[command](command_data)
            else:
                raise NoSuchCommandError(command)
        self.executed = True