:) test_fuel.py exist
:( correct fuel.py passes all test_fuel checks
expected exit code 0, not 2
:| test_fuel catches fuel.py returning incorrect ints in convert
can't check until a frown turns upside down
:| test_fuel catches fuel.py not raising ValueError in convert
can't check until a frown turns upside down
:| test_fuel catches fuel.py not raising ZeroDivisionError in convert
can't check until a frown turns upside down
:| test_fuel catches fuel.py not labeling 1% as E in gauge
can't check until a frown turns upside down
:| test_fuel catches fuel.py not printing % in gauge
can't check until a frown turns upside down
:| test_fuel catches fuel.py not labeling 99% as F in gauge
can't check until a frown turns upside down
2 Answers
The test that is failing is NOT importing YOUR fuel.py
. It is testing YOUR test_fuel.py
against the check50 test version of fuel.py
(called the "correct fuel.py" in the link). That way check50 knows fuel.py
is correct.
One or more of your tests return exit code 2 instead of 0, so are considered failing. You have to isolate the test that does this. The best way I found is to run check50 with only 1 test function in test_fuel.py
. If it passes the "correct fuel.py" test, it's OK. [Ignore errors for latter tests that you haven't implemented yet.] If doesn't, fix the test function until it does. Then, continue the process: add another test function, test it, and repeat until all tests pass. Eventually you will find the culprit. Good luck.
Clearly, it isn't working fine. It's failing the first test. Without seeing any code, there's no way to tell why.
The check50 run provides a link to the test results. Go to it and look at the details of why it fails. Also, try running the program locally, using the data used in the test.
-
submit.cs50.io/check50/7d0def9c4a77d899fa4248f391797ffbfe40f9ad Commented Nov 11, 2022 at 19:52
-
Well that didn't help. If you go look at the check50 source code (google it), you should be able to find the test cases. Anyways, the code is clearly failing for some reason. Have you run more tests locally with different inputs? A single test case that passes is not good testing. You need to exercise the code thoroughly.– Cliff BCommented Nov 11, 2022 at 21:39