Skip to content

Test Case¤

TestCase dataclass ¤

TestCase(
    node_id: str,
    path: str,
    name: str,
    doc: str,
    markers: list[str],
    parameters: dict[str, str],
    node_type: str = "case",
    module: str | None = None,
    suite: str | None = None,
    function: str | None = None,
)

A collected test case.

Attributes:

Name Type Description
doc str

The test docstring (optional).

function str | None

The function name (optional).

markers list[str]

The test markers. Each marker is a string.

module str | None

The module name where the test case is defined (optional).

name str

Test Name

node_id str

The node ID of the test case.

node_type str

The node type. Always set to 'case'.

parameters dict[str, str]

Test parameters names and types. Each key is a parameter name and each value is a parameter type as a string.

path str

The file path where the test case is defined.

suite str | None

The test suite name where the test case is defined (optional).

doc instance-attribute ¤

doc: str

The test docstring (optional).

function class-attribute instance-attribute ¤

function: str | None = None

The function name (optional).

markers instance-attribute ¤

markers: list[str]

The test markers. Each marker is a string.

module class-attribute instance-attribute ¤

module: str | None = None

The module name where the test case is defined (optional).

name instance-attribute ¤

name: str

Test Name

node_id instance-attribute ¤

node_id: str

The node ID of the test case.

node_type class-attribute instance-attribute ¤

node_type: str = 'case'

The node type. Always set to 'case'.

parameters instance-attribute ¤

parameters: dict[str, str]

Test parameters names and types. Each key is a parameter name and each value is a parameter type as a string.

path instance-attribute ¤

path: str

The file path where the test case is defined.

suite class-attribute instance-attribute ¤

suite: str | None = None

The test suite name where the test case is defined (optional).