Help with Arithmetic Formatter tests!

Hey there!
I recently (today) started the FreeCodeCamp arithmetic formatter project and sat through the day working on it with my pretty limited programming skills.

Anyways, it LOOKS like it works properly to me, but it still fails the tests related to arrangement, could one of you point out why that might be for me?

Repl link:

code snippet

Hi @DominikPaculla!
I believe that the FreeCodeCamp forum could assist you better with this. The freeCodeCamp Forum


Hello, I cannot tell easily from the repl’s output, but you could do some simple debugging to figure out the problem because the tests aren’t really helping that much it seems.

In the test_template function, in the fail message, you should include the repr of the actual output.
What’s the point of the test fail message if it doesn’t tell you anything you don’t know, and it doesn’t tell you what values are causing the failure?

assert actual == expected_output, (
    "fail: " + repr(actual) + " != " + repr(expected_output)


Whoops, looks like your function always returns None when there are no errors but returns a string error message when there is an error.

I don’t know how to use pytest, to make the test cases use output instead of return value, but at least you know the problem now.

There’s also a lot of improvements you could make to your code, such as using f-strings.