File tree 2 files changed +20
-12
lines changed
minesweeper/tests/unittests
2 files changed +20
-12
lines changed Original file line number Diff line number Diff line change
1
+ from typing import List
2
+
3
+ from minesweeper .src .Cell import Cell
4
+ from minesweeper .src .State import State
5
+
6
+
7
+ class BoardUtilities :
8
+ @staticmethod
9
+ def create_empty_board () -> List [List [Cell ]]:
10
+ expected_cells = []
11
+ for i in range (9 ):
12
+ row = []
13
+ for j in range (9 ):
14
+ row .append (Cell (State .EMPTY ))
15
+ expected_cells .append (row )
16
+ return expected_cells
Original file line number Diff line number Diff line change 1
1
import unittest
2
2
3
- from minesweeper .src .Cell import Cell
4
3
from minesweeper .src .Game import Game
5
- from minesweeper .src . State import State
4
+ from minesweeper .tests . unittests . BoardUtilies import BoardUtilities
6
5
7
6
8
7
class EmptyBoardUnitTest (unittest .TestCase ):
9
8
9
+
10
10
def setUp (self ):
11
11
self .game = Game ()
12
12
@@ -18,14 +18,6 @@ def test_when_game_is_started_it_is_running(self):
18
18
assert self .game .isRunning == True
19
19
20
20
def test_board_is_empty_on_start (self ):
21
- expected_cells = []
22
- for i in range (9 ):
23
- row = []
24
- for j in range (9 ):
25
- row .append (Cell (State .EMPTY ))
26
- expected_cells .append (row )
27
-
28
- print (self .game .board .cells )
21
+ assert self .game .board .cells == BoardUtilities .create_empty_board ()
22
+ assert self .game .board .isEmpty () == True ;
29
23
30
- assert self .game .board .cells == expected_cells
31
- assert self .game .board .isEmpty () == True ;
You can’t perform that action at this time.
0 commit comments