def test_super_interaction(
        sim_info: SimInfo,
        super_interaction_id: int,
        target: Any=None,
        interaction_context: InteractionContext=None,
        **kwargs
    ) -> TestResult:
        """test_super_interaction(\
            sim_info,\
            super_interaction_id,\
            target=None,\
            interaction_context=None,\
            **kwargs\
        )

        Test to see if a Super Interaction can be pushed into the queue of a Sim.

        :param sim_info: An instance of a Sim.
        :type sim_info: SimInfo
        :param super_interaction_id: The decimal identifier of a super interaction.
        :type super_interaction_id: int
        :param target: The target of the interaction. Default is None.
        :type target: Any, optional
        :param interaction_context: The context to queue the interaction with. See also :func:`~create_interaction_context`. Default is None.
        :type interaction_context: InteractionContext, optional
        :return: The result of testing a push of the interaction to the queue of a Sim.
        :rtype: TestResult
        """
        sim = CommonSimUtils.get_sim_instance(sim_info)
        if sim is None:
            return TestResult.NONE

        if target is not None and CommonTypeUtils.is_sim_or_sim_info(target):
            target = CommonSimUtils.get_sim_instance(target)

        interaction_context = interaction_context or CommonSimInteractionUtils.create_interaction_context(sim_info)
        super_interaction_instance = CommonInteractionUtils._load_interaction_instance(super_interaction_id)
        if super_interaction_instance is None:
            return TestResult.NONE

        return sim.test_super_affordance(
            super_interaction_instance,
            target,
            interaction_context,
            picked_object=target,
            **kwargs
        )
    def test_mixer_interaction(
        sim_info: SimInfo,
        mixer_interaction_id: int,
        target: Any=None,
        interaction_context: InteractionContext=None,
        **kwargs
    ) -> TestResult:
        """test_mixer_interaction(\
            sim_info,\
            mixer_interaction_id,\
            target=None,\
            interaction_context=None,\
            **kwargs\
        )

        Test to see if a Mixer Interaction can be pushed into the Queue of a Sim.

        :param sim_info: An instance of a Sim.
        :type sim_info: SimInfo
        :param mixer_interaction_id: The decimal identifier of a mixer interaction.
        :type mixer_interaction_id: int
        :param target: The target of the interaction. Default is None.
        :type target: Any, optional
        :param interaction_context: The context to queue the interaction with. See also :func:`~create_interaction_context`. Default is None.
        :type interaction_context: InteractionContext, optional
        :return: The result of testing a push of the interaction to the queue of a Sim.
        :rtype: TestResult
        """
        from autonomy.content_sets import get_valid_aops_gen

        sim = CommonSimUtils.get_sim_instance(sim_info)
        if sim is None:
            return TestResult.NONE
        if sim.posture is None:
            return TestResult.NONE
        if target is not None and CommonTypeUtils.is_sim_or_sim_info(target):
            target = CommonSimUtils.get_sim_instance(target)
        mixer_interaction_instance = CommonInteractionUtils._load_interaction_instance(mixer_interaction_id)
        if mixer_interaction_instance is None:
            return TestResult.NONE
        source_interaction = sim.posture.source_interaction
        if source_interaction is None:
            return TestResult.NONE
        if hasattr(mixer_interaction_instance, 'lock_out_time') and mixer_interaction_instance.lock_out_time:
            sim_specific_lockout = mixer_interaction_instance.lock_out_time.target_based_lock_out
        else:
            sim_specific_lockout = False

        if sim_specific_lockout and sim.is_sub_action_locked_out(mixer_interaction_instance):
            return TestResult.NONE

        super_interaction_instance = source_interaction.super_affordance
        interaction_context = interaction_context or CommonSimInteractionUtils.create_interaction_context(sim_info)
        for (aop, test_result) in get_valid_aops_gen(
            target,
            mixer_interaction_instance,
            super_interaction_instance,
            source_interaction,
            interaction_context,
            False,
            push_super_on_prepare=False
        ):
            test_result: TestResult = test_result
            if test_result is None or test_result.result:
                continue
            interaction_constraint = aop.constraint_intersection(sim=sim, posture_state=None)
            # noinspection PyPropertyAccess
            posture_constraint = sim.posture_state.posture_constraint_strict
            constraint_intersection = interaction_constraint.intersect(posture_constraint)
            if not constraint_intersection.valid:
                continue
            return aop.test(interaction_context, **kwargs)
    def test_social_mixer_interaction(
        sim_info: SimInfo,
        social_mixer_interaction_id: int,
        social_super_interaction_id: int,
        target: SimInfo=None,
        interaction_context: InteractionContext=None,
        **kwargs
    ) -> TestResult:
        """test_social_mixer_interaction(\
            sim_info,\
            social_mixer_interaction_id,\
            social_super_interaction_id,\
            target=None,\
            interaction_context=None,\
            **kwargs\
        )

        Test to see if a Social Mixer Interaction can be pushed into the queue of a Sim.

        :param sim_info: An instance of a Sim.
        :type sim_info: SimInfo
        :param social_mixer_interaction_id: The decimal identifier of a social mixer interaction.
        :type social_mixer_interaction_id: int
        :param social_super_interaction_id: The decimal identifier of a social super interaction to queue the social mixer interaction under.
        :type social_super_interaction_id: int
        :param target: The target of the interaction. Default is None.
        :type target: Any, optional
        :param interaction_context: The context to queue the interaction with. See also :func:`~create_interaction_context`. Default is None.
        :type interaction_context: InteractionContext, optional
        :return: The result of testing a push of the interaction to the queue of a Sim.
        :rtype: TestResult
        """
        if social_super_interaction_id is not None and social_mixer_interaction_id is None:
            return CommonSimInteractionUtils.test_super_interaction(social_super_interaction_id, target=target, interaction_context=interaction_context)
        sim = CommonSimUtils.get_sim_instance(sim_info)
        # noinspection PyTypeChecker
        super_affordance_instance = CommonInteractionUtils._load_interaction_instance(social_super_interaction_id)
        if super_affordance_instance is None:
            return TestResult.NONE
        mixer_affordance_instance = CommonInteractionUtils._load_interaction_instance(social_mixer_interaction_id)
        if mixer_affordance_instance is None:
            return TestResult.NONE

        def _get_existing_social_super_interaction(si_iter) -> Interaction:
            for si in si_iter:
                if si.super_affordance != super_affordance_instance:
                    continue
                if si.social_group is None:
                    continue
                target_sim = CommonSimUtils.get_sim_instance(target)
                if target_sim is not None and target_sim not in si.social_group:
                    continue
                return si.super_interaction

        interaction_context = interaction_context or CommonSimInteractionUtils.create_interaction_context(sim_info)
        super_interaction = _get_existing_social_super_interaction(sim.si_state) or _get_existing_social_super_interaction(sim.queue)
        if super_interaction is None:
            si_result = sim.test_super_affordance(
                super_affordance_instance,
                target,
                interaction_context,
                picked_object=target,
                **kwargs
            )
            if not si_result or not si_result.result:
                return TestResult.NONE
            super_interaction = si_result.interaction

        pick = super_interaction.context.pick
        preferred_objects = super_interaction.context.preferred_objects
        context = super_interaction.context.clone_for_continuation(
            super_interaction,
            insert_strategy=interaction_context.insert_strategy,
            source_interaction_id=super_interaction.id,
            source_interaction_sim_id=CommonSimUtils.get_sim_id(sim_info),
            pick=pick,
            preferred_objects=preferred_objects,
            must_run_next=interaction_context.must_run_next
        )
        aop = AffordanceObjectPair(
            mixer_affordance_instance,
            target,
            super_affordance_instance,
            super_interaction,
            picked_object=target,
            push_super_on_prepare=True
        )
        return aop.test(context)
    def test_interaction(
        sim_info: SimInfo,
        interaction_id: int,
        social_super_interaction_id: int=None,
        target: Any=None,
        interaction_context: InteractionContext=None,
        **kwargs
    ) -> TestResult:
        """test_interaction(\
            sim_info,\
            interaction_id,\
            social_super_interaction_id=None,\
            target=None,\
            interaction_context,\
            skip_if_running=False,\
            **kwargs\
        )

        Test to see if an Interaction can be pushed into the queue of a Sim.

        :param sim_info: An instance of a Sim.
        :type sim_info: SimInfo
        :param interaction_id: The decimal identifier of an interaction.
        :type interaction_id: int
        :param social_super_interaction_id: The decimal identifier of a social super interaction to queue the interaction under. Default is None
        :type social_super_interaction_id: int, optional
        :param target: The target of the interaction. Default is None.
        :type target: Any, optional
        :param interaction_context: The context to queue the interaction with. See also :func:`~create_interaction_context`. Default is None.
        :type interaction_context: InteractionContext, optional
        :return: The result of testing a push of the interaction to the queue of a Sim.
        :rtype: TestResult
        """
        sim = CommonSimUtils.get_sim_instance(sim_info)
        if sim is None or sim.si_state is None or sim.queue is None or sim.posture_state is None or sim.posture is None:
            return TestResult.NONE
        interaction_instance = CommonInteractionUtils._load_interaction_instance(interaction_id)
        if interaction_instance is None:
            return TestResult.NONE

        interaction_context = interaction_context or CommonSimInteractionUtils.create_interaction_context(
            sim_info,
            insert_strategy=QueueInsertStrategy.LAST
        )

        if CommonInteractionUtils.is_super_interaction(interaction_instance):
            return CommonSimInteractionUtils.test_super_interaction(
                sim_info,
                interaction_id,
                target=target,
                interaction_context=interaction_context,
                **kwargs
            )

        if CommonInteractionUtils.is_social_mixer_interaction(interaction_instance):
            return CommonSimInteractionUtils.test_social_mixer_interaction(
                sim_info,
                interaction_id,
                social_super_interaction_id,
                target=target,
                interaction_context=interaction_context,
                **kwargs
            )

        return CommonSimInteractionUtils.test_mixer_interaction(
            sim_info,
            interaction_id,
            target=target,
            interaction_context=interaction_context
        )
    def queue_interaction(
        sim_info: SimInfo,
        interaction_id: int,
        social_super_interaction_id: int=None,
        target: Any=None,
        interaction_context: InteractionContext=None,
        skip_if_running: bool=False,
        **kwargs
    ) -> EnqueueResult:
        """queue_interaction(\
            sim_info,\
            interaction_id,\
            social_super_interaction_id=None,\
            target=None,\
            interaction_context,\
            skip_if_running=False,\
            **kwargs\
        )

        Push an Interaction into the queue of a Sim.

        :param sim_info: An instance of a Sim.
        :type sim_info: SimInfo
        :param interaction_id: The decimal identifier of an interaction.
        :type interaction_id: int
        :param social_super_interaction_id: The decimal identifier of a social super interaction to queue the interaction under. Default is None
        :type social_super_interaction_id: int, optional
        :param target: The target of the interaction. Default is None.
        :type target: Any, optional
        :param interaction_context: The context to queue the interaction with. See also :func:`~create_interaction_context`. Default is None.
        :type interaction_context: InteractionContext, optional
        :param skip_if_running: If True, the interaction will not be queued, if it is already queued or running. If False, the interaction will be queued, even if it is already queued or running.
        :return: The result of pushing the interaction to the queue of a Sim.
        :rtype: EnqueueResult
        """
        sim = CommonSimUtils.get_sim_instance(sim_info)
        if sim is None or sim.si_state is None or sim.queue is None or sim.posture_state is None or sim.posture is None:
            return EnqueueResult.NONE
        interaction_instance = CommonInteractionUtils._load_interaction_instance(interaction_id)
        if interaction_instance is None:
            return EnqueueResult.NONE
        if skip_if_running and CommonSimInteractionUtils.has_interaction_running_or_queued(sim_info, interaction_id):
            return EnqueueResult.NONE

        interaction_context = interaction_context or CommonSimInteractionUtils.create_interaction_context(
            sim_info,
            insert_strategy=QueueInsertStrategy.LAST
        )

        if CommonInteractionUtils.is_super_interaction(interaction_instance):
            return CommonSimInteractionUtils.queue_super_interaction(
                sim_info,
                interaction_id,
                target=target,
                interaction_context=interaction_context,
                **kwargs
            )

        if CommonInteractionUtils.is_social_mixer_interaction(interaction_instance):
            return CommonSimInteractionUtils.queue_social_mixer_interaction(
                sim_info,
                interaction_id,
                social_super_interaction_id,
                target=target,
                interaction_context=interaction_context,
                **kwargs
            )

        return CommonSimInteractionUtils.queue_mixer_interaction(
            sim_info,
            interaction_id,
            target=target,
            interaction_context=interaction_context
        )