@@ -8,23 +8,32 @@ def test_use_print():
88 regex = re .compile (r"print(\s)*\(" )
99 assert bool (regex .search (content )) == True
1010
11- @pytest .mark .it ('Almost there! But you need to convert the incoming input from string to integer ' )
12- def test_convert_inputs (capsys , app ):
11+ @pytest .mark .it ('The solution should return the expected output. Tested with 2, 3, 6 ' )
12+ def test_sum_expected_inputs (capsys , app ):
1313
14- fake_input = ["2" ,"3" ,"4 " ] #fake input
14+ fake_input = ["2" ,"3" ,"6 " ] #fake input
1515 with mock .patch ('builtins.input' , lambda x : fake_input .pop ()):
1616 app ()
1717 captured = capsys .readouterr ()
18- assert captured .out != "432 \n "
18+ assert captured .out == "11 \n "
1919
20- @pytest .mark .it ('Sum all three input numbers and print on the console the result ' )
21- def test_add_variables (capsys , app ):
20+ @pytest .mark .it ('The solution must sum all entries. Tested with 0, 3, 7 ' )
21+ def test_sum_another_inputs (capsys , app ):
2222
23- fake_input = ["2 " ,"3" ,"4 " ] #fake input
23+ fake_input = ["0 " ,"3" ,"7 " ] #fake input
2424 with mock .patch ('builtins.input' , lambda x : fake_input .pop ()):
2525 app ()
2626 captured = capsys .readouterr ()
27- assert captured .out == "9\n "
27+ assert captured .out == "10\n "
28+
29+ @pytest .mark .it ('The solution must sum all entries. Tested with 0, 0, 0' )
30+ def test_sum_with_zero (capsys , app ):
31+
32+ fake_input = ["0" ,"0" ,"0" ] #fake input
33+ with mock .patch ('builtins.input' , lambda x : fake_input .pop ()):
34+ app ()
35+ captured = capsys .readouterr ()
36+ assert captured .out == "0\n "
2837
2938
3039
0 commit comments