CheckCondition
Descriptor class for deferred condition checking.
Attributes
| Attribute | Type | Description |
|---|---|---|
| conditions | tuple | A 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
| Name | Type | Description |
|---|---|---|
| *conditions | tuple | A 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
| Name | Type | Description |
|---|---|---|
| condition | callable | A callable that returns a boolean indicating whether the test should be skipped. |
| reason | string | The explanation string to be displayed when the condition evaluates to True. |
Returns
| Type | Description |
|---|---|
[CheckCondition](checkcondition.md?sid=django_test_testcases_checkcondition) | A new CheckCondition instance containing the updated list of conditions and reasons. |