File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 22
33import re
44from pathlib import Path
5- from typing import Iterator
5+ from typing import TYPE_CHECKING , Iterator
66
77import pytest
8- from PIL .Image import Image
98
109import langchain_community .document_loaders .parsers as pdf_parsers
1110from langchain_community .document_loaders .base import BaseBlobParser
1817 PyPDFParser ,
1918)
2019
20+ if TYPE_CHECKING :
21+ from PIL .Image import Image
22+
23+
2124# PDFs to test parsers on.
2225HELLO_PDF = Path (__file__ ).parent .parent .parent / "examples" / "hello.pdf"
2326
@@ -135,7 +138,7 @@ def test_extract_images_text_from_pdf_pypdfium2parser() -> None:
135138
136139
137140class EmptyImageBlobParser (BaseImageBlobParser ):
138- def _analyze_image (self , img : Image ) -> str :
141+ def _analyze_image (self , img : " Image" ) -> str :
139142 return "Hello world"
140143
141144
@@ -157,6 +160,7 @@ def _analyze_image(self, img: Image) -> str:
157160 ("PyMuPDFParser" , {}),
158161 ],
159162)
163+ @pytest .mark .requires ("pillow" )
160164def test_mode_and_extract_images_variations (
161165 parser_factory : str ,
162166 params : dict ,
You can’t perform that action at this time.
0 commit comments