checkio.referee.cover_codes
    cover_codes.unwrap_args -- Your "input" from test can be given as a list. if you want unwrap this
        before user function calling, then using this function. For example: if your test's input
        is [2, 2] and you use this cover_code, then user function will be called as checkio(2, 2)
    cover_codes.unwrap_kwargs -- the same as unwrap_kwargs, but unwrap dict.

"""

from checkio.signals import ON_CONNECT
from checkio import api
from checkio.referees.code import CheckiORefereeCode
from checkio.referees import cover_codes
from checkio.referees import checkers

from tests import TESTS


def checker(result, test_data):
    return result['code_result']

api.add_listener(
    ON_CONNECT,
    CheckiORefereeCode(
        tests=TESTS,
        check_result=checker,
        # add_allowed_modules=[],
        # add_close_builtins=[],
        # remove_allowed_modules=[]
    ).on_ready)
from checkio import api
from checkio.signals import ON_CONNECT
from checkio.referees.code import CheckiORefereeCode

from tests import TESTS
from inspector import inspector

api.add_listener(
    ON_CONNECT,
    CheckiORefereeCode(
        tests=TESTS,
        # check_result=None,
        inspector=inspector,
        # add_close_builtins=None,
        # add_allowed_modules=None,
        # remove_allowed_modules=None,
    ).on_ready,
)
Beispiel #3
0
def result_in_answers(data, test):
    # Compare list and tuple doesn't raise an error: be sure all are tuples.
    user_result = tuple(data['code_result'])
    answers = map(tuple, test['answer'])
    return user_result in answers, None


if __name__ != '__main__':
    from checkio import api
    from checkio.signals import ON_CONNECT
    from checkio.referees.code import CheckiORefereeCode

    api.add_listener(
        ON_CONNECT,
        CheckiORefereeCode(
            tests=TESTS,
            check_result=result_in_answers,
        ).on_ready,
    )

else:
    try:
        from my_solution import bot, magician
    except ImportError:
        print('You can check all tests locally, '
              'if your script is named "my_solution.py".')
    else:
        all_tests = ((cat, test_nb, test) for cat, tests in TESTS.items()
                     for test_nb, test in enumerate(tests, 1))
        nb_success = 0
        for cat, test_nb, test in all_tests:
            test_code = test['show']['python-3']
        remove_allowed_modules -- close standard library modules, as example "math"

checkio.referee.checkers
    checkers.float_comparison -- Checking function fabric for check result with float numbers.
        Syntax: checkers.float_comparison(digits) -- where "digits" is a quantity of significant
            digits after coma.

checkio.referee.cover_codes
    cover_codes.unwrap_args -- Your "input" from test can be given as a list. if you want unwrap this
        before user function calling, then using this function. For example: if your test's input
        is [2, 2] and you use this cover_code, then user function will be called as checkio(2, 2)
    cover_codes.unwrap_kwargs -- the same as unwrap_kwargs, but unwrap dict.

"""


from checkio import api
from checkio.signals import ON_CONNECT
from checkio.referees.code import CheckiORefereeCode

from tests import TESTS

api.add_listener(
    ON_CONNECT,
    CheckiORefereeCode(
        tests=TESTS,
        add_close_builtins=[
            "import", "eval", "exec", "send_token", "check_token"
        ],
    ).on_ready)
Beispiel #5
0
checkio.referee.checkers
    checkers.float_comparison -- Checking function fabric for check result with float numbers.
        Syntax: checkers.float_comparison(digits) -- where "digits" is a quantity of significant
            digits after coma.

checkio.referee.cover_codes
    cover_codes.unwrap_args -- Your "input" from test can be given as a list. if you want unwrap this
        before user function calling, then using this function. For example: if your test's input
        is [2, 2] and you use this cover_code, then user function will be called as checkio(2, 2)
    cover_codes.unwrap_kwargs -- the same as unwrap_kwargs, but unwrap dict.

"""

from checkio.signals import ON_CONNECT
from checkio import api
from checkio.referees.code import CheckiORefereeCode
from checkio.referees import cover_codes
from checkio.referees import checkers

from tests import TESTS

api.add_listener(
    ON_CONNECT,
    CheckiORefereeCode(
        tests=TESTS,
        # checker=None,  # checkers.float.comparison(2)
        # add_allowed_modules=[],
        # add_close_builtins=[],
        # remove_allowed_modules=[]
    ).on_ready)
from checkio.signals import ON_CONNECT
from checkio import api
from checkio.referees.code import CheckiORefereeCode
from checkio.referees import cover_codes
from checkio.referees import checkers

from tests import TESTS

api.add_listener(
    ON_CONNECT,
    CheckiORefereeCode(
        tests=TESTS,
        # add_allowed_modules=[],
        add_close_builtins=[
            "import",
            # "__import__",
            "eval",
            "exec",
            "min",
            "max"
        ],
        # remove_allowed_modules=[]
    ).on_ready)