The output looks correct to me, but it’s failing all of the arrangement tests. Please save me?
Can you please show the test output? It looks like you may have spacing issues.
Sorry I was doing some testing. I think it might be trailing spaces after the last problem.
_____________________ test_template[test_two_problems_arrangement1] _____________________
arguments = [['3801 - 2', '123 + 49']]
expected_output = ' 3801 123\n- 2 + 49\n------ -----'
fail_message = 'Expected different output when calling "arithmetic_arranger()" with ["3801 - 2", "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 ["3801 - 2", "123 + 49"]
E assert ' 3801 123 \n- 2 + 49 \n------ ----- \n' == ' 3801 123\n- 2 + 49\n------ -----'
E - 3801 123
E + 3801 123
E ? ++++
E - - 2 + 49
E + - 2 + 49
E ? ++++
E - ------ -----
E + ------ -----
E ? +++++
test_module.py:77: AssertionError
- 3801 123
+ 3801 123
? ++++
- - 2 + 49
+ - 2 + 49
? ++++
This says that you have 4 extra spaces at the end of these lines
1 Like
Thank you!
For future coders, the key was looking at the output of the raw string, instead of the formatted output in the console: “print(repr(arranged_problems))”
1 Like
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.