From 274e3414ccc36245fe5d8aff61cf4595534e85e7 Mon Sep 17 00:00:00 2001 From: Shing Zhan Date: Sun, 14 Jan 2024 18:01:52 +0000 Subject: [PATCH] Move assert to GeneticMap class --- python/tests/beagle_numba.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/tests/beagle_numba.py b/python/tests/beagle_numba.py index 1068ec3be2..694ff918a2 100644 --- a/python/tests/beagle_numba.py +++ b/python/tests/beagle_numba.py @@ -25,7 +25,12 @@ class GeneticMap: gen_pos: np.ndarray def __post_init__(self): - assert len(self.base_pos) == len(self.gen_pos) + assert len(self.base_pos) == len( + self.gen_pos + ), "Lists of physical positions and genetic map positions differ in length." + assert ( + self.base_pos[1:] > self.base_pos[:-1] + ), "Physical positions not in strict ascending order." def convert_to_genetic_map_positions(pos, genetic_map=None): @@ -66,8 +71,6 @@ def convert_to_genetic_map_positions(pos, genetic_map=None): left_idx[i] ] # Genetic map position at right of marker i. assert pos[i] >= a, f"Query position not >= left-bound position: {pos[i]}, {a}." - # TODO: Assert when instantiating GeneticMap. - assert b > a, f"Physical positions not in strict ascending order: {b}, {a}." assert ( fb >= fa ), f"Genetic map positions not in monotonically ascending order: {fb}, {fa}."