The problem was:
Convert: Takes a string input in the form “X/Y” where X and Y are integers, computes the percentage X/Y * 100 rounded to the nearest
integer, and handles errors such as division by zero or non-integer
inputs.Gauge: Takes an integer percentage and returns: “E” if the percentage is 1 or less. “F” if the percentage is 99 or more.
Otherwise, it should return the percentage followed by “%”.
And write a test file using pytest.
my main file code
heres the test case code:
My test code is correct, but whenever I ran it, the test case where we check the errors raised was giving errors. with “pytest.raises(ValueError): convert(“dog/cat”)”
It seems try catch needed to be executed twice. Can someone enlighten me for a better way?
heres the correct main file code for reference :
2