Verify correctness of LabControlObject's __hash__ and __eq__ methods
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
Direzione di ricerca
Inizia individuando LabControlObject e leggendo le sue implementazioni di hash e eq. Confronta il modo in cui trattano _table, type() e id, quindi aggiungi test mirati per oggetti uguali e valori hash corrispondenti; il lavoro è completato quando il contratto di uguaglianza previsto è documentato, implementato in modo coerente e verificato dai test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 2
- Fork
- 15
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di biocore/LabControl
-
bug front-end question
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
biocore/LabControl#594 ·
-
front-end question
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
biocore/LabControl#593 ·
-
front-end
biocore/LabControl#592 · 1 assegnatario ·
-
code refactor front-end
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
biocore/LabControl#591 ·
-
priority:low
Difficoltà 3/5 1-2 giorni Idoneità per principianti 20/100
biocore/LabControl#590 ·
Tutte le issue di biocore/LabControl
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
stephrobert/dsoxlab#238 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
sublimehq/package_control#1780 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
nwg-piotr/nwg-displays#145 ·