Added
-
Pandas / polars / numpy data-frame and array assertions.
Fluent equality for pandas/polars
DataFrame/Series(is_frame_equal) and numpy arrays (is_array_equal,is_array_close_to), delegating comparison semantics to each library's ownassert_frame_equal/assert_allcloseand carrying its diff on failure. Optional extra:pip install assertpy2[pandas](or[polars],[numpy],[data]).Before:
AttributeError: assertpy has no assertion <is_frame_equal()>Now:
assert_that(df).is_frame_equal(expected, check_dtype=False) assert_that(arr).is_array_close_to(expected, rtol=1e-3)
Improved
-
Richer dict diffs.
A failing
is_equal_to()on a dict now decomposes nested dataclasses, models, namedtuples and nested lists to the exact differing path (matching the detail already shown for top-level values), and dicts with mixed-type keys no longer raise.@dataclass class Point: x: int y: int assert_that({"point": Point(1, 2)}).is_equal_to({"point": Point(1, 3)})
Before - the nested object was reported as one leaf:
point: - Point(x=1, y=2) + Point(x=1, y=3)Now - decomposed to the exact differing path:
point.y: - 2 + 3
Fixed
-
Clear error when comparing array/frame-likes.
is_equal_to()/is_not_equal_to()on a numpy array or pandas/polars frame now raise a clear, actionableTypeErrorinstead of the library's cryptic "ambiguous truth value".assert_that(df).is_equal_to(other)
Before:
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), ...Now:
TypeError: is_equal_to() cannot directly compare <DataFrame>: its '==' is element-wise and has no single truth value. Compare the value's own equality (e.g. assert_that(actual.equals(expected)).is_true()), assert on extracted scalars (columns, shape, length), or use satisfies(...) with an explicit predicate.
Internal
- Restructured the README integrations section (compact, linked) and added a data-frame row to the comparison table.
- Bumped dev type-checker
tyto 0.0.55; renamed a snapshot test off a dev-phase name.