Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Verify correctness of LabControlObject's __hash__ and __eq__ methods

Aperta
#494 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python
Ambito
backend

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

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.

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di biocore/LabControl

Tutte le issue di biocore/LabControl

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.