-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_display_maze.py
18 lines (14 loc) · 1.14 KB
/
test_display_maze.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import pytest
from SRC.Main import *
import mock
import io
maze_normal = [['X', 'X', 'X', 'X', 'X', 'X', 'X', 'X'], ['X', 'O', 'O', 'O', 'X', 'O', 'A', 'X'], ['X', 'O', 'X', 'O', 'X', 'O', 'X', 'X'], ['X', 'O', 'X', 'O', 'X', 'O', 'O', 'X'], ['X', 'O', 'X', 'O', 'X', 'X', 'O', 'X'], ['X', 'O', 'X', 'O', 'X', 'O', 'O', 'X'], ['X', 'O', 'X', 'O', 'O', 'O', 'X', 'X'], ['X', 'B', 'X', 'X', 'X', 'X', 'X', 'X']]
maze_no_start_end = [['X', 'X', 'X', 'X', 'X', 'X', 'X', 'X'], ['X', 'O', 'O', 'O', 'X', 'O', 'X', 'X'], ['X', 'O', 'X', 'O', 'X', 'O', 'X', 'X'], ['X', 'O', 'X', 'O', 'X', 'O', 'O', 'X'], ['X', 'O', 'X', 'O', 'X', 'X', 'O', 'X'], ['X', 'O', 'X', 'O', 'X', 'O', 'O', 'X'], ['X', 'O', 'X', 'O', 'O', 'O', 'X', 'X'], ['X', 'X', 'X', 'X', 'X', 'X', 'X', 'X']]
# ==================================================================
# Test display maze
def test_display_maze_available():
assert display_maze(maze_normal) == maze_normal
def test_display_maze_empty():
with mock.patch('sys.stdout', new=io.StringIO()) as fake_stdout:
display_maze([])
assert fake_stdout.getvalue() == 'No maze in memory. Load your maze file through Option 1!\n'