Skip to content

Conversation

@jamesbraza
Copy link
Collaborator

#1046 missed updating Text.__eq__/__hash__

@jamesbraza jamesbraza self-assigned this Nov 4, 2025
Copilot AI review requested due to automatic review settings November 4, 2025 06:17
@jamesbraza jamesbraza added the bug Something isn't working label Nov 4, 2025
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Nov 4, 2025
@dosubot
Copy link

dosubot bot commented Nov 4, 2025

Related Documentation

Checked 1 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures that the media field is properly considered when comparing and hashing Text objects, maintaining consistency between equality and hash operations.

  • Added media comparison to the __eq__ method of the Text class
  • Updated __hash__ to include media (converted to tuple for hashability)
  • Added comprehensive tests for Text equality and hashing with media

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/paperqa/types.py Updated Text.__eq__ to compare media field and Text.__hash__ to include media in the hash calculation
tests/test_paperqa.py Added test_text_comparison to verify equality and hashing behavior with and without media

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 4, 2025
@jamesbraza jamesbraza merged commit 10b69ff into main Nov 4, 2025
13 checks passed
@jamesbraza jamesbraza deleted the updating-text-hash branch November 4, 2025 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants