Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Verify correctness of LabControlObject's __hash__ and __eq__ methods

Open
#494 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

Start by locating LabControlObject and reading its hash and eq implementations. Compare their treatment of _table, type(), and id, then add focused tests for equal objects and matching hash values; done means the intended equality contract is documented, consistently implemented, and verified by tests.

Written by the indexing model from the issue text.

Description

priority:low

As @wasade has pointed out, the base class for most if not all of LabControl's classes is LabControlObject, and this object implements the hash and eq methods.

On review of that code, I'm not convinced the eq method is correct. The hash is hash((self._table, self.id)) whereas eq tests for equality of type() and the id property. This leads to a pathological edge case where two objects can have the same hash but not test equal if an the objects use the same table but have a different subclass. Similarly, this means that two objects can have a different hash, but test equal, if objects of the same type have different _table values.

I don't often implement hash and eq in classes, so I reviewed the code and tested it for myself and I've confirmed this to be true.

At @wasade's request, we should review/test the code and verify whether or not eq's behavior should be changed to match hash or not.

Dominant language
Python
Stars
2
Forks
15
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from biocore/LabControl

All issues in biocore/LabControl

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.