You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Defensive Programming section, there is a test for patient_normalise that checks a ValueError is raised when negative values are passed to the function:
@p-j-smith thanks for this detailed issue and apologies it has taken us so long to get around to it! I've got a PR #451 up that should address everything. I have opted to put the stuff about "matching" in an optional exercise because I feel like it is just a bit of a stretch for everyone who might be taking the course, but could be really helpful for the more advanced learners. The point about using if expected_raises is not None was already incorporated into the course material at some other time, but regardless, thanks for pointing it out.
In the
Defensive Programming
section, there is a test forpatient_normalise
that checks aValueError
is raised when negative values are passed to the function:This could be simplified to:
Also, it's best to check the specific error message being thrown:
And there is a check for whether
raises
isValueError
orNone
:However, it's better to always explicitly check that a variable is not
None
:It makes no difference here, but other times some statements (e.g.
[]
) could evaluate toFalse
and lead to the wrong code block executed.The text was updated successfully, but these errors were encountered: