Week 5
Refueling
The gauge, split into two functions: one turns a fraction into a number, one turns that number into the gauge.
You write the tests. The functions take a fraction and a number.
Tests for ordinary values and for the cases that should raise.
The question, more slowly
The question is: split the gauge into two functions. One turns a fraction string into a percentage integer. One turns that integer into the gauge string. Tests call those functions. They also check that bad fractions raise the errors the spec names.
Convert should raise when the text is not integers, when the denominator is zero, or when the numerator is larger. Gauge should map the low end, the high end, and the middle. The spec says the cutoffs.
Pytest can expect a raise. The spec points at the docs for that. A test that catches the error and ignores it does not fail when the function forgets to raise.
Before you code
The spec shows how a test can expect a function to raise. Read that page before you invent the syntax.