Commit 1a7e100d authored by Antonio Caceres's avatar Antonio Caceres
Browse files

Switch LHS and RHS output for diff.

parent 61024535
No related merge requests found
Pipeline #106533 failed with stage
in 0 seconds
Showing with 12 additions and 10 deletions
+12 -10
......@@ -9,7 +9,7 @@ from tests.helpers.naming import apply_names
]))
def test_get_opponent(player, expected):
result = task1.get_opponent(player)
assert result == expected, f"get_opponent({player}) returned {result}, but the expected value is {expected}."
assert expected == result, f"get_opponent({player}) returned {result}, but the expected value is {expected}."
@pytest.mark.parametrize('player', apply_names('get_opponent', [True], [
......
......@@ -31,4 +31,4 @@ from tests.helpers.naming import apply_names
def test_check_valid_coord(coord, board, expected):
result = task2.check_valid_coord(coord, board)
assert result == expected, f"go_to_next_round(check_valid_coord({coord}, boardX) with boardX of length {len(board)} returned {result}, but the expected value is {expected}."
assert expected == result, f"go_to_next_round(check_valid_coord({coord}, boardX) with boardX of length {len(board)} returned {result}, but the expected value is {expected}."
......@@ -21,4 +21,4 @@ inputs = [
@pytest.mark.parametrize('inps, expected', apply_names('', ['input = ', False], inputs, noparens=True))
def test_ask_coordinates(inps, expected):
result = intercept(gogo_ask_coordinates, inps)
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}."
assert expected == result, 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}."
......@@ -10,6 +10,6 @@ from tests.helpers.naming import apply_names
def test_board_size(size, expected):
board = task6.make_boolean_square_board(size)
assert len(board) == expected, f"Not all rows are of length {expected} in the board returned by make_boolean_square_board({size})."
assert all(len(row) == expected for row in board), f"Not all columns are of length {expected} in the board returned by make_boolean_square_board({size})."
assert all(cell == False for row in board for cell in row), f"Not all cells are set to False in the board returned by make_boolean_square_board({size})."
assert expected == len(board), f"Not all rows are of length {expected} in the board returned by make_boolean_square_board({size})."
assert all(expected == len(row) for row in board), f"Not all columns are of length {expected} in the board returned by make_boolean_square_board({size})."
assert all(False == cell for row in board for cell in row), f"Not all cells are set to False in the board returned by make_boolean_square_board({size})."
......@@ -28,5 +28,7 @@ inps = [
def test_ships_placed(inputs, i, expected_ships_placed):
expected_output = expected_outputs[i].replace("\033c", "CLEAR")
result = intercept(gogo_place_ships, inputs).replace("\033c", "CLEAR")
assert result == expected_output#, f"Calling place_ships and providing the following inputs:\n{inputs}\nthe resulting outputs are:\n{result}\nwhen we expect:\n{expected_output}."
assert ships_placed == expected_ships_placed#, f"Calling place_ships and providing the following inputs:\n{inputs}\nthe resulting ships_placed are:\nships_placed = {ships_placed}\nwhen we expect:\nships_placed = {expected_ships_placed}."
\ No newline at end of file
assert expected_output == result, f"method place_ships did not provide the correct output to console, see diff (LHS v RHS)."
# Longer message: f"Calling place_ships and providing the following inputs:\n{inputs}\nthe resulting outputs are:\n{result}\nwhen we expect:\n{expected_output}."
assert expected_ships_placed == ships_placed, f"method place_ships did not correctly place ships, see diff (LHS v RHS)."
# Longer message: f"Calling place_ships and providing the following inputs:\n{inputs}\nthe resulting ships_placed are:\nships_placed = {ships_placed}\nwhen we expect:\nships_placed = {expected_ships_placed}."
......@@ -80,4 +80,4 @@ inputs = [
@pytest.mark.parametrize('desc, board_ships, board_hits, player, size_board, expected', apply_names('', [True, False, False, False, False, False, False], inputs, noparens=True))
def test_check_win(desc, board_ships, board_hits, player, size_board, expected):
result = task11.check_win(board_ships, board_hits, player, size_board)
assert result == expected, f"check_win({board_ships}, {board_hits}, {player}, {size_board}) returned {result}, but the expected value is {expected}."
assert expected == result, f"check_win({board_ships}, {board_hits}, {player}, {size_board}) returned {result}, but the expected value is {expected}."
......@@ -14,4 +14,4 @@ from tests.helpers.naming import apply_names
]))
def test_go_to_next_round(player, current_round, expected_round):
result = task12.go_to_next_round(player, current_round)
assert result == expected_round, f"go_to_next_round({player}, {current_round}) returned {result}, but the expected value is {expected_round}."
assert expected_round == result, f"go_to_next_round({player}, {current_round}) returned {result}, but the expected value is {expected_round}."
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment