Hi. I need some help with this project.
When I run my code on my PC, using the test cases, the output “looks” fine.
In replit , I am failing only one test and don’t understand the error output – any direction would be great.
I copied the failing test input parameters to main.py before the auto test and I added
‘’‘print(repr (arithmetic_arranger ([“3 + 855”, “3801 - 2”, “45 + 43”, “123 + 49”])))’‘’
the output from the main.py test repr is:
‘’‘’’ 3 3801 45 123\n+ 855 - 2 + 43 + 49\n----- ------ ---- -----’
This shows a single newline – the test package assert remains the same and the test package test FAILS.
Here is the error output from the test package:
________________ test_template[test_four_problems_arrangement] _________________
arguments = [[]]
expected_output = ' 3 3801 45 123\n+ 855 - 2 + 43 + 49\n----- ------ ---- -----'
fail_message = 'Expected different output when calling "arithmetic_arranger()" with ["3 + 855", "3801 - 2", "45 + 43", "123 + 49"]'
@pytest.mark.parametrize('arguments,expected_output,fail_message', test_cases)
def test_template(arguments, expected_output, fail_message):
actual = arithmetic_arranger(*arguments)
> assert actual == expected_output, fail_message
E AssertionError: Expected different output when calling "arithmetic_arranger()" with ["3 + 855", "3801 - 2", "45 + 43", "123 + 49"]
E assert '\n\n' == (' 3 3801 45 123\n'\n '+ 855 - 2 + 43 + 49\n'\n '----- ------ ---- -----')
E Strings contain only whitespace, escaping them using repr()
E - ' 3 3801 45 123\n+ 855 - 2 + 43 + 49\n----- ------ ---- -----'
E + '\n\n'
test_module.py:77: AssertionError
=========================== short test summary info ============================
FAILED test_module.py::test_template[test_four_problems_arrangement] - Assert...
========================= 1 failed, 9 passed in 0.11s ===
Challenge: Arithmetic Formatter
Link to the challenge: