carpentries-incubator / carpentries-incubator/python-intermediate-development
Missing Patient class
- Langage dominant
- TeX
- Étoiles
- 63
- Forks
- 77
- Merge moyen
- 20 h 8 min
- PR mergées (30 j)
- 3
Description
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
```
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par inflammation/models.py et tests/test_patient.py dans le projet inflammation lié, puis consultez les épisodes sur persistence et databases pour comprendre le comportement attendu de Patient. Restaurez la classe Patient décrite dans l’issue et exécutez test_patient.py ; c’est terminé lorsque les tests models.Patient référencés passent.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- backend, testing
- Type d'issue
- Bug
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- À l'abandon
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 45/100