import pytest from tests.helpers.test_helpers import * inputs = [ (["No commas", "1,1"], "Your coordinates format is invalid! Please enter as x,y.\n"), (["Not, the, right, size, I, fear", "1,1"], "Your coordinates must be 2 numbers!\n"), (["Need numbers, despite correct size", "1,1"], "Your coordinates must be 2 numbers!\n"), (["0,1,2,3,4,5", "1,1"], "Your coordinates must be 2 numbers!\n"), (["4,0", "1,1"], "Make sure that the location is valid!\n"), (["0,4", "1,1"], "Make sure that the location is valid!\n"), (["4,1", "1,1"], "Make sure that the location is valid!\n"), (["1,4", "1,1"], "Make sure that the location is valid!\n"), (["I don't like commas", "222", ",,,", "digit,digit", "digit,2", "2,digit", "2,2,2", "1,4", "4,1", "1,1"], "Your coordinates format is invalid! Please enter as x,y.\nYour coordinates format is invalid! Please enter as x,y.\nYour coordinates must be 2 numbers!\nYour coordinates must be 2 numbers!\nYour coordinates must be 2 numbers!\nYour coordinates must be 2 numbers!\nYour coordinates must be 2 numbers!\nMake sure that the location is valid!\nMake sure that the location is valid!\n"), (["2,2"], ""), (["1,3"], ""), (["3,1"], "") ] @pytest.mark.parametrize('i', range(len(inputs))) def test_ask_coordinates(i): result = intercept(gogo_ask_coordinates, inputs[i][0]) expected = inputs[i][1] assert result == expected, f"On a 7x7 board, the following inputs on the ask_coordinates function:\n{inputs}\nlead to the following output:\n{result}\nwhen we expect:\n{expected}."