carpentries-incubator / carpentries-incubator/python-intermediate-development
Missing Patient class
- Lingua principale
- TeX
- Stelle
- 63
- Fork
- 77
- Merge medio
- 20h 8m
- PR unite (30g)
- 3
Descrizione
The extras episodes on [persistence](https://carpentries-incubator.github.io/python-intermediate-development/persistence.html) and [databases](https://carpentries-incubator.github.io/python-intermediate-development/databases.html) assume a Patient class is in the inflammation project. This class was removed with the new section 3.
The test [ `test_patient.py`](https://github.com/carpentries-incubator/python-intermediate-inflammation/blob/main/tests/test_patient.py) refers to a models.Patient class but it does not exist in [models.py](https://github.com/carpentries-incubator/python-intermediate-inflammation/blob/main/inflammation/models.py).
We could easily fix this by adding the Patient class back to models.py:
```python
class Observation:
def __init__(self, day, value):
self.day = day
self.value = value
def __str__(self):
return str(self.value)
class Patient:
"""A patient in an inflammation study."""
def __init__(self, name):
self.name = name
self.observations = []
def add_observation(self, value, day=None):
if day is None:
try:
day = self.observations[-1].day + 1
except IndexError:
day = 0
new_observation = Observation(day, value)
self.observations.append(new_observation)
return new_observation
def __str__(self):
return self.name
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia da inflammation/models.py e tests/test_patient.py nel progetto inflammation collegato, poi esamina gli episodi su persistence e databases per capire come dovrebbe comportarsi Patient. Ripristina la classe Patient descritta nella issue ed esegui test_patient.py; il lavoro è completato quando i test models.Patient indicati superano l’esecuzione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- backend, testing
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100