From 473ca885be7f603158e7f1b16384a658dc1e6494 Mon Sep 17 00:00:00 2001 From: Nuno Fachada Date: Tue, 23 Jan 2024 11:06:15 +0000 Subject: [PATCH] Add test for rng exception in clugen() --- tests/test_main.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/test_main.py b/tests/test_main.py index d56d988..674bf16 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -829,6 +829,34 @@ def test_clugen_exceptions(prng): rng=prng, ) + # Invalid rng + with pytest.raises( + ValueError, + match=re.escape( + "`rng` must be an instance of int or Generator, but is " + ), + ): + clugen( + nd, + nclu, + 0, + direc, + astd, + clu_sep, + len_mu, + len_std, + lat_std, + allow_empty=ae, + cluster_offset=clu_off, + proj_dist_fn=pt_dist, + point_dist_fn=pt_off, + clusizes_fn=csizes_fn, + clucenters_fn=ccenters_fn, + llengths_fn=llengths_fn, + angle_deltas_fn=langles_fn, + rng="not valid", + ) + class _PointsClusters(NamedTuple): points: NDArray