Hello All,
I’ve been working on Arithmetic Arranger problem. Even though my output is exactly as it is desired. I’m still getting the following error. Any help would be extremely appreciated.
Error:
=============================== FAILURES ================================
_____________ 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 <function arithmetic_arranger at 0x7ff08a6feca0> == ' 3801 123\n- 2 + 49\n------ -----'
test_module.py:77: AssertionError
------------------------- Captured stdout call --------------------------
3801 123
- 2 + 49
------ -----
_____________ test_template[test_two_problems_arrangement2] _____________
arguments = [['1 + 2', '1 - 9380']]
expected_output = ' 1 1\n+ 2 - 9380\n--- ------'
fail_message = 'Expected different output when calling "arithmetic_arranger()" with ["1 + 2", "1 - 9380"]'
@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 ["1 + 2", "1 - 9380"]
E assert <function arithmetic_arranger at 0x7ff08a6feca0> == ' 1 1\n+ 2 - 9380\n--- ------'
test_module.py:77: AssertionError
------------------------- Captured stdout call --------------------------
1 1
+ 2 - 9380
--- ------
_____________ test_template[test_four_problems_arrangement] _____________
arguments = [['3 + 855', '3801 - 2', '45 + 43', '123 + 49']]
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 <function arithmetic_arranger at 0x7ff08a6feca0> == ' 3 3801 45 123\n+ 855 - 2 + 43 + 49\n----- ------ ---- -----'
test_module.py:77: AssertionError
------------------------- Captured stdout call --------------------------
3 3801 45 123
+ 855 - 2 + 43 + 49
----- ------ ---- -----
_____________ test_template[test_five_problems_arrangement] _____________
arguments = [['11 + 4', '3801 - 2999', '1 + 2', '123 + 49', '1 - 9380']]
expected_output = ' 11 3801 1 123 1\n+ 4 - 2999 + 2 + 49 - 9380\n---- ------ --- ----- ------'
fail_message = 'Expected different output when calling "arithmetic_arranger()" with ["11 + 4", "3801 - 2999", "1 + 2", "123 + 49", "1 - 9380"]'
@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 ["11 + 4", "3801 - 2999", "1 + 2", "123 + 49", "1 - 9380"]
E assert <function arithmetic_arranger at 0x7ff08a6feca0> == ' 11 3801 1 123 1\n+ 4 - 2999 + 2 + 49 - 9380\n---- ------ --- ----- ------'
test_module.py:77: AssertionError
------------------------- Captured stdout call --------------------------
11 3801 1 123 1
+ 4 - 2999 + 2 + 49 - 9380
---- ------ --- ----- ------
____________ test_template[test_two_problems_with_solutions] ____________
arguments = [['3 + 855', '988 + 40'], True]
expected_output = ' 3 988\n+ 855 + 40\n----- -----\n 858 1028'
fail_message = 'Expected solutions to be correctly displayed in output when calling "arithmetic_arranger()" with ["3 + 855", "988 + 40"] and a second argument of `True`.'
@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 solutions to be correctly displayed in output when calling "arithmetic_arranger()" with ["3 + 855", "988 + 40"] and a second argument of `True`.
E assert <function arithmetic_arranger at 0x7ff08a6feca0> == ' 3 988\n+ 855 + 40\n----- -----\n 858 1028'
test_module.py:77: AssertionError
------------------------- Captured stdout call --------------------------
3 988
+ 855 + 40
----- -----
858 1028
___________ test_template[test_five_problems_with_solutions] ____________
arguments = [['32 - 698', '1 - 3801', '45 + 43', '123 + 49', '988 + 40'], True]
expected_output = ' 32 1 45 123 988\n- 698 - 3801 + 43 + 49 + 40\n----- ------ ---- ----- -----\n -666 -3800 88 172 1028'
fail_message = 'Expected solutions to be correctly displayed in output when calling "arithmetic_arranger()" with five arithmetic problems and a second argument of `True`.'
@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 solutions to be correctly displayed in output when calling "arithmetic_arranger()" with five arithmetic problems and a second argument of `True`.
E assert <function arithmetic_arranger at 0x7ff08a6feca0> == ' 32 1 45 123 988\n- 698 - 3801 + 43 + 49 + 40\n----- ------ ---- ----- -----\n -666 -3800 88 172 1028'
test_module.py:77: AssertionError
------------------------- Captured stdout call --------------------------
32 1 45 123 988
- 698 - 3801 + 43 + 49 + 40
----- ------ ---- ----- -----
-666 -3800 88 172 1028
======================== short test summary info ========================
FAILED test_module.py::test_template[test_two_problems_arrangement1]
FAILED test_module.py::test_template[test_two_problems_arrangement2]
FAILED test_module.py::test_template[test_four_problems_arrangement]
FAILED test_module.py::test_template[test_five_problems_arrangement]
FAILED test_module.py::test_template[test_two_problems_with_solutions]
FAILED test_module.py::test_template[test_five_problems_with_solutions]
====================== 6 failed, 4 passed in 0.36s ======================
Your code so far
Challenge: Scientific Computing with Python Projects - Arithmetic Formatter
Link to the challenge: