def test_validate_image_adds_channel_dimension(self) -> None:
        """Test validation of an image without channel dimension."""
        # Create a 2D image without channel dimension
        input_image = np.zeros((224, 224))

        # Validate the image
        validated_image = self.validator.validate_image(input_image)
        # Check if channel dimension is added
        assert validated_image.shape == (224, 224, 1), "Channel dimension should be added"
        # Ensure the dtype is converted to float32
        assert validated_image.dtype == np.float32, "Image should be converted to float32"
        # Verify that the image content is preserved
        assert pytest.approx(validated_image[:, :, 0]) == input_image.astype(
            np.float32,
        ), "Image content should be preserved"
Test validation of an image without channel dimension.
tests/unit/data/validators/numpy/test_image.py