def multiple_value_test(self, out1, out2, function):
        """
        Testing multiple output types.
        :param out1: anything
        :param out2: anything
        :param function: object
        """
        code = ['def ' + function.__name__ + '(a, b):',
                '',
                '    if not a and b:',
                '        return ' + c.print_object(out1),
                '',
                '    if a and not b:',
                '        return ' + c.print_object(out2),
                '',
                '    return False']

        cond = s.Conditions(a=False, b=True, output=out1)  # non-boolean output
        cond.add(a=True, b=False, output=out2)  # non-boolean condition
        solution = s.execute(self, function, cond)
        self.assertEqual(solution.implementation, code)
    def test_mix_output_boolean(self):
        """
        When ifs and pure boolean expression mix.
        """
        function = f.mix_output
        out = 'a'
        code = ['def ' + function.__name__ + '(a, b):',
                '',
                '    if not a and b:',
                '        return ' + c.print_object(out),
                '    return a and b']

        cond = s.Conditions(a=False, b=True, output=out)  # non-boolean output
        cond.add(a=True, b=True)  # boolean output
        solution = s.execute(self, function, cond)
        self.assertEqual(solution.implementation, code)
    def test_function_outputs(self):
        """
        When output is a function.
        """
        function = f.output_function_obj
        out1 = f.fun9
        code = ['def ' + function.__name__ + '(a, b):',
                '',
                '    if not a and b:',
                '        return ' + c.print_object(out1),
                '',
                '    return False']

        cond = s.Conditions(a=False, b=True, output=out1)  # non-boolean output
        solution = s.execute(self, function, cond)
        self.assertEqual(solution.implementation, code)