@@ -934,17 +934,17 @@ async def test_repeat_keys(stub_data_dir) -> None:
934
934
@pytest .mark .asyncio
935
935
async def test_pdf_reader_w_no_match_doc_details (stub_data_dir : Path ) -> None :
936
936
docs = Docs ()
937
- await docs .aadd (
937
+ docname = await docs .aadd (
938
938
stub_data_dir / "paper.pdf" ,
939
939
"Wellawatte et al, XAI Review, 2023" ,
940
940
)
941
+ (doc_details ,) = docs .docs .values ()
942
+ assert doc_details .docname == docname , "Added name should match between details"
941
943
# doc will be a DocDetails object, but nothing can be found
942
944
# thus, we retain the prior citation data
943
945
assert (
944
- next (iter (docs .docs .values ())).citation == "Wellawatte et al, XAI Review, 2023"
945
- )
946
- assert (
947
- next (iter (docs .docs .values ())).formatted_citation
946
+ doc_details .citation
947
+ == doc_details .formatted_citation
948
948
== "Wellawatte et al, XAI Review, 2023"
949
949
), "Formatted citation should be the same when no metadata is found."
950
950
@@ -1016,7 +1016,7 @@ async def test_partly_embedded_texts(defer_embeddings: bool) -> None:
1016
1016
@pytest .mark .asyncio
1017
1017
async def test_pdf_reader_match_doc_details (stub_data_dir : Path ) -> None :
1018
1018
docs = Docs ()
1019
- await docs .aadd (
1019
+ docname = await docs .aadd (
1020
1020
stub_data_dir / "paper.pdf" ,
1021
1021
"Wellawatte et al, A Perspective on Explanations of Molecular Prediction"
1022
1022
" Models, XAI Review, 2023" ,
@@ -1027,7 +1027,8 @@ async def test_pdf_reader_match_doc_details(stub_data_dir: Path) -> None:
1027
1027
}, # Limit to only crossref since s2 is too flaky
1028
1028
fields = ["author" , "journal" , "citation_count" ],
1029
1029
)
1030
- doc_details = next (iter (docs .docs .values ()))
1030
+ (doc_details ,) = docs .docs .values ()
1031
+ assert doc_details .docname == docname , "Added name should match between details"
1031
1032
# Crossref is non-deterministic in its ordering for results
1032
1033
# thus we need to capture both possible dockeys
1033
1034
assert doc_details .dockey in {"d7763485f06aabde" , "5300ef1d5fb960d7" }
0 commit comments