Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: use ak.almost_equal in test utility function assert_eq #377

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading