pola-rs/polars · error · AssertionError

{objects} are different ({detail}) [left]: {left} [right]:

Error message

{objects} are different ({detail})
[left]:  {left}
[right]: {right}

What it means

Generic assertion-message builder (raise_assertion_error) used by polars.testing assert frame/series equality helpers: it formats a comparison failure between the left (actual) and right (expected) objects, with `detail` naming the specific mismatch (values, dtype, shape, etc.). Seeing it means an assert_*_equal test found a concrete difference, not a crash.

Source

Thrown at py-polars/src/polars/testing/asserts/utils.py:12

from __future__ import annotations

from typing import Any, NoReturn


def raise_assertion_error(
    objects: str, detail: str, left: Any, right: Any, *, cause: Exception | None = None
) -> NoReturn:
    """Raise a detailed assertion error."""
    __tracebackhide__ = True
    msg = f"{objects} are different ({detail})\n[left]:  {left}\n[right]: {right}"
    raise AssertionError(msg) from cause

View on GitHub (pinned to 9b5d73fd00)

Solutions

  1. Inspect the reported left/right values and detail; fix the data or the assertion so the compared objects match as expected.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at py-polars/src/polars/testing/asserts/utils.py:12 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19). Data as JSON: /api/errors/655ed0290674e471. Report an issue: GitHub.