carpentries-incubator / carpentries-incubator/python-intermediate-development

Missing Patient class

オープン
#415 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TeX
スター
63
フォーク
77
平均マージ
20時間 8分
マージ済み PR(30日)
3

説明

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

```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

リンクされた inflammation プロジェクトの inflammation/models.py と tests/test_patient.py から始め、次に persistence と databases のエピソードを確認して、Patient がどのように動作することを想定されているかを把握します。issue に記載された Patient クラスを復元し、test_patient.py を実行します。参照されている models.Patient のテストがパスすれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
backend, testing
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。