|
11 | 11 | import unstructured_inference.models.base as models |
12 | 12 | from unstructured_inference.inference import elements, layout, layoutelement |
13 | 13 | from unstructured_inference.inference.layout import create_image_output_dir |
14 | | -from unstructured_inference.models import detectron2, tesseract |
| 14 | +from unstructured_inference.models import chipper, detectron2, tesseract |
15 | 15 | from unstructured_inference.models.unstructuredmodel import ( |
16 | 16 | UnstructuredElementExtractionModel, |
17 | 17 | UnstructuredObjectDetectionModel, |
@@ -866,3 +866,14 @@ def test_create_image_output_dir_no_ext(): |
866 | 866 | assert os.path.isdir(output_dir) |
867 | 867 | assert os.path.isabs(output_dir) |
868 | 868 | assert output_dir == expected_output_dir |
| 869 | + |
| 870 | + |
| 871 | +def test_warning_if_chipper_and_low_dpi(caplog): |
| 872 | + with patch.object(layout.DocumentLayout, "from_file") as mock_from_file, patch.object( |
| 873 | + chipper.UnstructuredChipperModel, |
| 874 | + "initialize", |
| 875 | + ): |
| 876 | + layout.process_file_with_model("asdf", model_name="chipper", pdf_image_dpi=299) |
| 877 | + mock_from_file.assert_called_once() |
| 878 | + assert caplog.records[0].levelname == "WARNING" |
| 879 | + assert "DPI >= 300" in caplog.records[0].msg |
0 commit comments