It's often hard to unit test graphical apps. It's not impossible, but it can be tricky. One strategy is to try to encapsulate any "pure" logic in its own functions so you can just unit test that logic without the drawing.
import unittest
# assuming your `Maze` class is in a file called `maze.py`
from maze import Maze
class Tests(unittest.TestCase):
def test_maze_create_cells(self):
num_cols = 12
num_rows = 10
m1 = Maze(0, 0, num_rows, num_cols, 10, 10)
self.assertEqual(
len(m1._Maze__cells),
num_cols,
)
self.assertEqual(
len(m1._Maze__cells[0]),
num_rows,
)
Note the object._class__property syntax to access private properties outside the class. This is a result of Python's (feeble) attempt at hiding them through name mangling.
if __name__ == "__main__":
unittest.main()
python3 tests.py
Run and submit the CLI tests.