carpentries-incubator / carpentries-incubator/python-intermediate-development
Missing Patient class
- Vorherrschende Sprache
- TeX
- Sterne
- 63
- Forks
- 77
- Ø Merge
- 20 Std. 8 Min.
- Gemergte PRs (30 T.)
- 3
Beschreibung
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
```
Beitragsleitfaden
Rechercherichtung
Beginne mit inflammation/models.py und tests/test_patient.py im verlinkten inflammation-Projekt und sieh dir anschließend die Episoden zu persistence und databases an, um zu verstehen, wie sich Patient verhalten soll. Stelle die in der Issue beschriebene Patient-Klasse wieder her und führe test_patient.py aus; fertig ist die Aufgabe, wenn die referenzierten models.Patient-Tests bestehen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- backend, testing
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100