Skip to content

Commit

Permalink
Handle no-cosmo_factor case in cosmo_array ufuncs (#215)
Browse files Browse the repository at this point in the history
* swiftsimio/objects.py

* Run black.

* Remove accidentally commited test files.
  • Loading branch information
kyleaoman authored Jan 2, 2025
1 parent c2a43ff commit 2032573
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions swiftsimio/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,10 @@ def _return_without_cosmo_factor(ca_cf, ca_cf2=None, inputs=None, zero_compariso
raise ValueError(
f"Ufunc arguments have cosmo_factors that differ: {cf} and {cf2}."
)
elif (cf is not None) and (cf2 is not None) and (cf == cf2):
# both have cosmo_factor, and they match:
elif ((cf is not None) and (cf2 is not None) and (cf == cf2)) or (
(cf is None) and (cf2 is None)
):
# both have cosmo_factor, and they match, or neither has cosmo_factor:
pass
else:
raise RuntimeError("Unexpected state, please report this error on github.")
Expand Down

0 comments on commit 2032573

Please sign in to comment.