Skip to content

Commit

Permalink
use ak.almost_equal
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasdavis committed Sep 26, 2023
1 parent a5cf0ab commit 114a056
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions src/dask_awkward/lib/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def assert_eq_arrays(
check_forms: bool = False,
check_divisions: bool = True,
scheduler: Any | None = None,
convert_to_lists: bool = False,
) -> None:
scheduler = scheduler or DEFAULT_SCHEDULER
a_is_coll = is_dask_collection(a)
Expand Down Expand Up @@ -86,15 +87,12 @@ def assert_eq_arrays(

# finally check the values
if isclose_equal_nan:
assert ak.all(
ak.isclose(
ak.from_iter(a_comp.tolist()),
ak.from_iter(b_comp.tolist()),
equal_nan=True,
)
)
assert ak.all(ak.isclose(a_comp, b_comp, equal_nan=True))
else:
assert a_comp.tolist() == b_comp.tolist()
if convert_to_lists:
assert a_comp.tolist() == b_comp.tolist()
else:
assert ak.almost_equal(a_comp, b_comp, dtype_exact=True)


def assert_eq_records(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def test_unnamed_root(
unnamed_root_parquet_file,
columns=columns,
)
assert_eq(daa, caa, check_forms=False)
assert_eq(daa, caa, convert_to_lists=True)


@pytest.mark.parametrize("prefix", [None, "abc"])
Expand Down

0 comments on commit 114a056

Please sign in to comment.