Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Removed trailing whitespace in formatted_answer, with a test
  • Loading branch information
jamesbraza committed Nov 1, 2025
commit 124987414976bafdeafdfb980159dd498d821661
2 changes: 1 addition & 1 deletion src/paperqa/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def populate_formatted_answers_and_bib_from_raw_answer(
)

if bib:
formatted_with_references += f"\n\nReferences\n\n{bib}\n"
formatted_with_references += f"\n\nReferences\n\n{bib}"

self.answer = formatted_without_references
self.formatted_answer = formatted_with_references
Expand Down
3 changes: 3 additions & 0 deletions tests/test_paperqa.py
Original file line number Diff line number Diff line change
Expand Up @@ -3008,6 +3008,9 @@ def test_pqa_context_id_parsing(raw_text: str, cleaned_text: str) -> None:
)
session.populate_formatted_answers_and_bib_from_raw_answer()
assert session.answer == cleaned_text
assert (
session.formatted_answer == session.formatted_answer.strip()
), "Expecting no leading/trailing whitespace"


@pytest.mark.asyncio
Expand Down
Loading