CAT-SOOP API: catsoop.check
Members
-
catsoop.check.check_result (
function, lines 35-56)Given a check function that directly compares values, return a new check function that compares the
'result'fields of a submission and solution using the given function. For use with thepythoncodequestion type.Parameters:
f(optional:) a function that compares two values. Defaults to comparison using==.
Returns: a function suitable for use as a
csq_check_function.
-
catsoop.check.dict_all (
function, lines 168-185)Given a function that directly compares two valies, generate a new check function that takes two dictionaries and checks that all keys are idntical, and that the associated values are equivalent according to the given function.
Parameters:
f(optional:) a function that compares two values. Defaults to comparison using==.
Returns: a function suitable for use as a
csq_check_function.
-
catsoop.check.equal (
function, lines 23-32)Generate a check function that checks whether two values are equivalent using Python's
==.Parameters: none
Returns: a function suitable for use as a
csq_check_function.
-
catsoop.check.evaled (
function, lines 95-116)Given a check function that directly compares values, return a new check function that evaluates its arguments (using
ast.literal_eval) before calling the given function on the evaluated resultsParameters:
f(optional:) a function that compares two values. Defaults to comparison using==.
Returns: a function suitable for use as a
csq_check_function.
-
catsoop.check.list_all (
function, lines 119-134)Given a function that compares two values, generate a new check function that checks that two lists are equal (same values in the same order).
Parameters:
f(optional:) a function that compares two values. Defaults to comparison using==.
Returns: a function suitable for use as a
csq_check_function.
-
catsoop.check.list_all_unordered (
function, lines 137-165)Given a function that directly compares two values, generate a new check function that checks whether two lists contain all the same elements (including duplicates), regardless of order.
Parameters:
f(optional:) a function that compares two values. Defaults to comparison using==.
Returns: a function suitable for use as a
csq_check_function.
-
catsoop.check.number_close (
function, lines 59-92)Generate a check function that checks whether two numbers are close (within the given thresholds).
Parameters:
absolute_threshold(optional): the maximum absolute difference that will be accepted.ration_threshold(optional): the maximum ratiosubmission / solutionthat will be accepted.
Returns: a function suitable for use as a
csq_check_function.