Skip to content

Static Checking⚓︎

checker ⚓︎

Static validation of Gherkin data tables against talika schemas.

The Gherkin dependency is imported lazily so normal runtime parsing remains dependency-free. Install the cli extra when using feature-file discovery or the talika check command.

Info

Static checking still runs schema parsers and validators. Supply deterministic dependencies through parse context when project validators normally depend on services or generators.

FeatureTable dataclass ⚓︎

FeatureTable(path: Path, feature: str, scenario: str, step: str, table: TableData)

One discovered Gherkin step data table.

Attributes:

  • path (Path) –

    Feature file path.

  • feature (str) –

    Feature name.

  • scenario (str) –

    Scenario or background name.

  • step (str) –

    Step text that owns the data table.

  • table (TableData) –

    Source-aware table converted from Gherkin AST cells.

Info

The stored TableData uses feature-file line and column coordinates, not indexes relative to the data table block.

FeatureDiagnostic dataclass ⚓︎

FeatureDiagnostic(
    path: Path, feature: str, scenario: str, step: str, error: TableError
)

One schema diagnostic associated with a feature file and step.

Attributes:

  • path (Path) –

    Feature file path.

  • feature (str) –

    Feature name.

  • scenario (str) –

    Scenario or background name.

  • step (str) –

    Step text that owns the failing data table.

  • error (TableError) –

    Structured table error raised by schema parsing.

Info

CLI JSON output is a rendering of this object plus the nested TableError attributes.

diagnostic property ⚓︎

diagnostic: Diagnostic

Return the shared immutable Diagnostic Model v1 value.

_gherkin_tools ⚓︎

_gherkin_tools() -> tuple[Any, Any]

Load the optional official Gherkin parser and pickle compiler.

Returns:

  • tuple[Any, Any]

    The Gherkin Parser and Compiler classes.

Raises:

  • TableError

    If the optional cli dependency is not installed.

Warning

This dependency is intentionally lazy so core table parsing has no runtime dependency on Gherkin parsing packages.

_table_data ⚓︎

_table_data(data_table: Mapping[str, Any], *, source: Path) -> TableData

Convert a Gherkin AST data table into TableData.

Parameters:

  • data_table (Mapping[str, Any]) –

    Gherkin AST mapping containing rows, cells, and locations.

  • source (Path) –

    Resolved feature file providing the table.

Returns:

  • TableData

    Source-aware TableData with feature-file coordinates.

Info

Coordinates come from the official parser's cell locations, so errors point to the feature file rather than to a normalized table index.

_scenario_nodes ⚓︎

_scenario_nodes(feature: Mapping[str, Any]) -> Iterable[Mapping[str, Any]]

Yield scenarios and backgrounds from a Gherkin feature node.

Parameters:

  • feature (Mapping[str, Any]) –

    Parsed Gherkin feature mapping.

Yields:

Info

Outline expansion is handled separately with the official Gherkin compiler after this traversal identifies the original scenario node.

_example_cells ⚓︎

_example_cells(
    scenario_node: Mapping[str, Any],
) -> dict[str, dict[str, Mapping[str, Any]]]

Map each Examples body-row ID to its parameter source cells.

_compiled_table_data ⚓︎

_compiled_table_data(
    source_table: Mapping[str, Any],
    compiled_table: Mapping[str, Any],
    parameters: Mapping[str, Mapping[str, Any]],
    *,
    source: Path,
) -> TableData

Combine compiled logical values with precise AST source locations.

_outline_tables ⚓︎

_outline_tables(
    *,
    source_path: Path,
    feature_name: str,
    scenario_node: Mapping[str, Any],
    pickles: Iterable[Mapping[str, Any]],
    step_filter: str | None,
) -> list[FeatureTable]

Expand one scenario outline into logical feature tables.

discover_feature_tables ⚓︎

discover_feature_tables(
    path: str | Path, *, step: str | None = None, scenario: str | None = None
) -> list[FeatureTable]

Return matching feature-file data tables.

Parameters:

  • path (str | Path) –

    Feature file path.

  • step (str | None, default: None ) –

    Optional exact step text filter.

  • scenario (str | None, default: None ) –

    Optional exact scenario/background name filter.

Returns:

Raises:

  • TableError

    If discovery cannot read or compile the feature file.

Example

tables = discover_feature_tables("users.feature", step="the users:")

check_feature ⚓︎

check_feature(
    path: str | Path,
    *,
    schema: type[BaseTable],
    step: str | None = None,
    scenario: str | None = None,
    context: Mapping[str, Any] | None = None,
) -> list[FeatureDiagnostic]

Validate matching feature tables without executing pytest scenarios.

Custom parsers and validators still run. Projects whose schemas require services should supply deterministic checking dependencies through context or through the CLI's context-factory option.

Parameters:

  • path (str | Path) –

    Feature file path.

  • schema (type[BaseTable]) –

    Schema used to parse matching data tables.

  • step (str | None, default: None ) –

    Optional exact step text filter.

  • scenario (str | None, default: None ) –

    Optional exact scenario/background name filter.

  • context (Mapping[str, Any] | None, default: None ) –

    Optional project data passed to schema parsing.

Returns:

Warning

Custom validation code executes during checking. Keep context factories deterministic and free of external side effects in CI/editor workflows.

check_feature_tables ⚓︎

check_feature_tables(
    tables: Iterable[FeatureTable],
    *,
    schema: type[BaseTable],
    context: Mapping[str, Any] | None = None,
) -> list[FeatureDiagnostic]

Validate already-discovered feature tables against one schema.

Parameters:

  • tables (Iterable[FeatureTable]) –

    Feature tables returned by discover_feature_tables.

  • schema (type[BaseTable]) –

    Schema used to parse each data table.

  • context (Mapping[str, Any] | None, default: None ) –

    Optional project data passed to schema parsing.

Returns:

Info

check_feature discovers tables and delegates here. The CLI calls this helper after its own discovery pass so it can count matches without parsing the feature file twice.