Continuing our discussion from #75 with @gvarnavi
Problem
validate_list_of_dataset2d is used for setters. At the moment, it doesn't support the following behavior: "I want to ensure there are at least two images in the list of dataset2d (in the case of DriftCorrection).
Proposed solution
Add an optional img_count_min parameter:
def validate_list_of_dataset2d(
images: List[Dataset2d] | List[NDArray] | Dataset3d | NDArray,
img_count_min: int = None,
) -> List[Dataset2d]:
"""
Validate that the passes images is a list of Dataset2d objects.
Parameters
----------
images : List[Dataset2d] | List[NDArray] | Dataset3d | NDArray
The images list to validate
img_count_min : int, optional
The minimum number of images expected to be present in `images`.
In practice, it can be used as the following?
def test_validate_list_of_dataset2d_with_wrong_min_image_count_specified():
img = np.random.random((10, 10))
with pytest.raises(ValueError, match="The 2D list requires a minimum of 2 images but only 1 has been provided."):
validate_list_of_dataset2d([img], image_count_min=2)
@gvarnavi