PY-9
Check a Function with Named Cases
Task
The workspace supplies this target function; do not rewrite it:
Write check_named_cases(cases). Each item in cases is a three-item tuple
containing a case name, an input value in Celsius, and the expected Fahrenheit
result:
(name, input_value, expected)
For each case, call convert_temperature(input_value) and compare the
returned value with expected. Return a list containing one three-item
mismatch tuple for every case whose result differs:
(name, expected, observed)
Keep mismatches in the same order as their cases. Return an empty list when every case matches. The function should be called once for each case. This problem does not prescribe a special policy for exceptions: an exception from the target should remain normally visible.
Example
The observed result for the second case is 68, so only that named mismatch is
returned. A case name is reported exactly as supplied. The target function is
called once for each case, including cases that match.
Your implementation
Edit solution.py and keep this function name and signature:
cases is a list of (name, input_value, expected) tuples. Call the supplied
convert_temperature function for each input. Return a list of
(name, expected, observed) tuples. Do not change cases or any case tuple,
and do not print or ask for input. This problem does not prescribe a special
policy for exceptions: an exception from the supplied target remains normally
visible.