Spaces:
Running
Running
File size: 908 Bytes
39fc36b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import pytest
import os
from langchain_core.documents import Document
from _utils.handle_files import return_document_list_with_llama_parser
cwd = os.getcwd()
pdf_file_url = os.path.join(cwd, "tests", "fixtures", "_pdf-uma-pagina.pdf")
class TestHandleFiles:
@pytest.mark.asyncio
async def test_return_document_list_with_llama_parser_With_wrong_keys(
self, monkeypatch
):
monkeypatch.setattr(
"_utils.handle_files.llama_parser_keys",
["abc", os.getenv("LLAMA_CLOUD_API_KEY_PEIXE")],
)
result = await return_document_list_with_llama_parser(pdf_file_url)
assert isinstance(result, list)
assert len(result) > 0
assert all(isinstance(item, Document) for item in result)
assert all(len(item.page_content) > 0 for item in result)
assert all(int(item.metadata.get("page", 0)) > 0 for item in result)
|