Closed AshishS-1123 closed 3 years ago
@jostbr could you please review this PR as soon as you can? Because i have written some algorithms for generating mazes. But since I am using Python3, I need to use some of the changes made in #35 (related to python 3 compatibility). So I cant create a PR for them unless #35 is merged. Or should I create a PR using the branch test-bug-fixes(used in #35)?
Changes Made
Why ?
The function time.clock was replaced by time.time for compatibility issues. According to the python documentation, the funciton time.clock is deprecated as of version 3.8. I changed this to make the code base compatible with all versions of python.
In tests/cell_tests.py, in line 52, the assertion value has been changed to True. Looking at the method Cell.set_as_entry_exit, the second if condition will match and the bottom wall will be removed but the right wall will be as is. Hence the change in assertion.
In tests/cell_tests.py, in line 63, the cell (0,0) is to the left of cell (0,1) and hence left wall will be removed.
In tests/cell_tests.py, the test method test_is_walls_between does not test the method Cell.test_is_walls_between. Only the remove_walls method was called. I rewrote this method to consider that.
The test_is_walls_between method implementation
This test should test whether there is a wall between any two cells. In the method, I created a cell which you can imagine to be at the center of a (2x2) maze. I also created 4 other cells, one at each side of this cell (top, bottom, right and left). So, there should be a wall between the cell at the center all the cells at the sides. The test also tests whether wall exists between two neighbouring cells if the common wall between them is removed.