Verify correctness of LabControlObject's __hash__ and __eq__ methods
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
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
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from biocore/LabControl
-
bug front-end question
Difficulty 4/5 3-5 days Newbie friendliness 30/100
biocore/LabControl#594 ·
-
front-end question
Difficulty 5/5 Over a week Newbie friendliness 35/100
biocore/LabControl#593 ·
-
front-end
biocore/LabControl#592 · 1 assignee ·
-
code refactor front-end
Difficulty 5/5 Over a week Newbie friendliness 25/100
biocore/LabControl#591 ·
-
priority:low
Difficulty 3/5 1-2 days Newbie friendliness 20/100
biocore/LabControl#590 ·
All issues in biocore/LabControl
Similar issues
-
area: harness bug status: needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Human-Agent-Society/reef#625 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
learningequality/kolibri#15351 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Name consistency Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
eellak/triplestore#65 · 1 comment ·