Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted "return" to "raise" for invalid values in cdc.py & uk_who.py #52

Open
wants to merge 1 commit into
base: live
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rcpchgrowth/cdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def cdc_reference(age: float, measurement_method, default_youngest_reference: bo
return CDC_CHILD_DATA

else:
return ValueError("There is no CDC reference data above the age of 20 years.")
raise ValueError("There is no CDC reference data above the age of 20 years.")


def cdc_lms_array_for_measurement_and_sex(
Expand Down
6 changes: 3 additions & 3 deletions rcpchgrowth/uk_who.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def uk_who_reference(
# These conditionals are to select the correct reference
if age < UK90_REFERENCE_LOWER_THRESHOLD:
# Below the range for which we have reference data, we can't provide a calculation.
return ValueError("There is no UK90 reference data below 23 weeks gestation")
raise ValueError("There is no UK90 reference data below 23 weeks gestation")
elif age < UK_WHO_INFANT_LOWER_THRESHOLD:
# Below 42 weeks, the UK90 preterm data is always used
return UK90_PRETERM_DATA
Expand Down Expand Up @@ -147,7 +147,7 @@ def uk_who_reference(
return UK90_CHILD_DATA

else:
return ValueError("There is no UK90 reference data above the age of 20 years.")
raise ValueError("There is no UK90 reference data above the age of 20 years.")


def uk_who_lms_array_for_measurement_and_sex(
Expand All @@ -165,7 +165,7 @@ def uk_who_lms_array_for_measurement_and_sex(
default_youngest_reference=default_youngest_reference
)
except: #  there is no reference for the age supplied
return LookupError("There is no UK-WHO reference for the age supplied.")
raise LookupError("There is no UK-WHO reference for the age supplied.")

# Check that the measurement requested has reference data at that age

Expand Down