unstructured/test_unstructured
qued 6c1bbb379c
test: add check crop box padding to save_elements test (#4123)
Updated `save_elements` test to check the behavior of the environment
variables `EXTRACT_IMAGE_BLOCK_CROP_HORIZONTAL_PAD` and
`EXTRACT_IMAGE_BLOCK_CROP_VERTICAL_PAD` that pad the crop box for image
extraction.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Enhances save_elements tests to validate crop-box padding via env vars
and image dimensions for both payload and file outputs; bumps version
and updates changelog.
> 
> - **Tests (pdf_image_utils)**:
> - `test_save_elements` now parametrizes
`horizontal_padding`/`vertical_padding`, sets
`EXTRACT_IMAGE_BLOCK_CROP_HORIZONTAL_PAD` and
`EXTRACT_IMAGE_BLOCK_CROP_VERTICAL_PAD`, and asserts padded image
dimensions for both `extract_image_block_to_payload` paths (decoding
`image_base64` or reading saved file).
>   - Adds required imports (`base64`, `io`).
> - **Versioning**:
>   - Update `unstructured/__version__.py` to `0.18.21-dev0`.
>   - Add CHANGELOG entry noting the unit test enhancement.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
a23bf6a9e7fb67f35c2aa16cc409d2de92886db8. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-11-18 22:01:50 +00:00
..