def test_process_request_calls_invalid_request_event_for_invalid_requests(self):
        from sijax.helper import json

        # An invalid request is a request for a function that's not registered,
        # meaning the request is invalid as far as sijax is concerned
        inst = Sijax()
        cls = inst.__class__
        inst.set_data({cls.PARAM_REQUEST: "my_func", cls.PARAM_ARGS: '["arg1", 12]'})
        self.assertTrue(inst.is_sijax_request)
        self.assertEqual("my_func", inst.requested_function)
        self.assertEqual(["arg1", 12], inst.request_args)

        response = inst.process_request()
        self.assertTrue(isinstance(response, string_types))

        try:
            commands = json.loads(response)
        except:
            self.fail("Invalid JSON generated!")
        else:
            self.assertTrue(isinstance(commands, list))

            # we expect the default "Invalid request" alert
            self.assertEqual(1, len(commands))
            command_data = commands.pop(0)
            self.assertTrue(command_data in "type")
            self.assertEqual("alert", command_data["type"])
dataset/ETHPy150Open spantaleev/sijax-python/tests/sijax_tests.py/SijaxMainTestCase.test_process_request_calls_invalid_request_event_for_invalid_requests/swapped operands of `in`