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
Notice that under the `pytest.raises` context manager, it isn't necessary to perform the `npt.assert_allclose` because just the call to `patient_normalise()` will raise the `ValueError`.
620
+
620
621
Be sure to commit your changes so far and push them to GitHub.
621
622
622
623
::::::::::::::::::::::::::::::::::::::: challenge
@@ -629,9 +630,17 @@ You will find the Python function
You can take this even further if your solution code involves multiple `ValueError`s or `TypeError`'s being raised at different locations.
635
+
In this case, you want to make sure the function is raising the precise `Exception` that occurs at a specific point in your function.
636
+
You might have noticed that `Exception`s can take a string argument corresponding to a message / description of the exception that has occurred.
637
+
The [`pytest.raises()`](https://docs.pytest.org/en/stable/reference/reference.html#pytest.raises) context manager can query this message with its `match=` argument.
638
+
See if you can use that to more precisely test the exceptions raised by your function.
639
+
632
640
Once you are done, commit your new files,
633
641
and push the new commits to your remote repository on GitHub.
634
642
643
+
635
644
::::::::::::::: solution
636
645
637
646
## Solution
@@ -683,6 +692,11 @@ from inflammation.models import patient_normalise
0 commit comments