a
    ¡˜ëjŒ  ã                   @   s*   d dl Z d dlmZmZ e jdd„ ƒZdS )é    N)ÚOCR_AGENT_PADDLEÚOCR_AGENT_TESSERACTc                    s*   ‡ fdd„}ddl m} ˆ jj|d|d�S )zQFixture that mocks OCRAgent.get_instance to prevent real OCR agent instantiation.c                    s&   | t tfv rˆ  ¡ S td| › �ƒ‚d S )NzUnknown OCR agent: )r   r   Z	MagicMockÚ
ValueError)Zocr_agent_moduleÚlanguage©Úmocker© úc/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/test_unstructured/partition/conftest.pyÚmock_get_instance
   s    z0mock_ocr_get_instance.<locals>.mock_get_instancer   )ÚOCRAgentZget_instance)Zside_effect)Z$unstructured.partition.pdf_image.ocrr   ÚpatchÚobject)r   r
   r   r   r   r	   Úmock_ocr_get_instance   s    r   )ZpytestZ&unstructured.partition.utils.constantsr   r   Zfixturer   r   r   r   r	   Ú<module>   s   