Skip to main content

CheckCondition

Descriptor class for deferred condition checking.

Attributes

AttributeTypeDescription
conditionstupleA collection of tuples containing callable predicates and their associated skip reason strings used to determine if a test should be bypassed.

Constructor

Signature

def CheckCondition(
*conditions: tuple
) - > null

Parameters

NameTypeDescription
*conditionstupleA variable number of condition-reason pairs to be evaluated.

Methods


add_condition()

@classmethod
def add_condition(
condition: callable,
reason: string
) - > [CheckCondition](checkcondition.md?sid=django_test_testcases_checkcondition)

Creates a new instance of the descriptor with an additional condition and its associated skip reason appended to the existing set.

Parameters

NameTypeDescription
conditioncallableA callable that returns a boolean indicating whether the test should be skipped.
reasonstringThe explanation string to be displayed when the condition evaluates to True.

Returns

TypeDescription
[CheckCondition](checkcondition.md?sid=django_test_testcases_checkcondition)A new CheckCondition instance containing the updated list of conditions and reasons.