A testing macro for comparing Polars DataFrames with configurable options. Use this in Rust unit tests to verify data processing results and ensure structural equality.
// Source: https://github.com/pola-rs/polars | License: MIT | Copyright 2025 Ritchie Vink
// Provided via justclaw.it.com; keep this notice with the code.
/// Asserts that two DataFrames are equal according to the specified options.
///
/// This macro compares two Polars DataFrame objects and panics with a detailed error message if they are not equal.
/// It provides two forms:
/// - With custom comparison options
/// - With default comparison options
///
/// # Example
///
/// ```
/// use polars_core::prelude::*;
/// use polars_testing::assert_dataframe_equal;
/// use polars_testing::asserts::DataFrameEqualOptions;
///
/// // Create two DataFrames to compare
/// let df1 = df! {
/// "a" => [1, 2, 3],
/// "b" => [4.0, 5.0, 6.0],
/// }.unwrap();
/// let df2 = df! {
/// "a" => [1,
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key