Example #1
0
def test_limit_add_record():
    collection = PatientCollection(CSV_PATH)
    limit = collection.limit(len(GOOD_PARAMS) + 10)
    for _ in range(len(GOOD_PARAMS)):
        next(limit)
    new_patient = Patient("Митрофан", "Космодемьянский", "1999-10-15",
                          "79030000000", PASSPORT_TYPE, "4510 000444")
    new_patient.save()
    last_patient = next(limit)
    for field in PATIENT_FIELDS:
        assert getattr(new_patient, field) == getattr(
            last_patient, field), f"Wrong attr {field} for changed limit"
Example #2
0
def test_save():
    patient = Patient(*GOOD_PARAMS)
    patient.save()