diff options
author | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-01-17 13:51:16 +0200 |
---|---|---|
committer | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-01-17 13:51:16 +0200 |
commit | 1bcfe93e8eb226563292d94805068c502de4ba95 (patch) | |
tree | ff14ab0acb705c635a6cc4983fb888fabaeba024 /tests/test_board.py | |
parent | 9acab08eeede3a3c065057d4466ccaef2035b55d (diff) |
Making Board class variables "private".
Diffstat (limited to 'tests/test_board.py')
-rw-r--r-- | tests/test_board.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/test_board.py b/tests/test_board.py index a74be9a..4fcd8d3 100644 --- a/tests/test_board.py +++ b/tests/test_board.py @@ -19,7 +19,7 @@ class TestBoardClass(unittest.TestCase): def test_get_view_and_guess(self): """ laudan näkymä on oikein senkin jälkeen kun on arvattu""" b = Board(3,3) - b.tiles=[[0,0,0],[0,1,1],[0,1,9]] + b._Board__tiles=[[0,0,0],[0,1,1],[0,1,9]] v = b.get_view() t = [[12,12,12],[12,12,12],[12,12,12]] @@ -37,18 +37,18 @@ class TestBoardClass(unittest.TestCase): def test_is_winning(self): """ toimiiko voittotilanteen tunnistus """ b = Board(2,2) - b.tiles=[[1,9],[9,9]] - b.masked=[[12,12],[12,12]] + b._Board__tiles=[[1,9],[9,9]] + b._Board__masked=[[12,12],[12,12]] self.assertFalse(b.is_winning()) - b.masked=[[0,12],[12,12]] + b._Board__masked=[[0,12],[12,12]] self.assertTrue(b.is_winning()) - b.masked=[[0,0],[12,12]] + b._Board__masked=[[0,0],[12,12]] self.assertFalse(b.is_winning()) def test_error_conditions_in_guess(self): """ ruudun avaus alueen ulkopuolelta tai avatussa ruudussa ei onnistu""" b = Board(2,2) - b.tiles=[[1,9],[9,9]] + b._Board__tiles=[[1,9],[9,9]] self.assertFalse(b.guess(2,2)) self.assertTrue(b.guess(0,0)) self.assertFalse(b.guess(0,0)) @@ -56,13 +56,13 @@ class TestBoardClass(unittest.TestCase): def test_get_mask(self): """ maski annetaan oikein """ b = Board(2,2) - b.tiles=[[1,9],[9,9]] + b._Board__tiles=[[1,9],[9,9]] self.assertEqual(b.get_mask(0,0), 12) def test_flag(self): """ ruudun liputus toimii """ b = Board(2,2) - b.tiles=[[1,9],[9,9]] + b._Board__tiles=[[1,9],[9,9]] self.assertEqual(b.get_mask(0,0), 12) self.assertTrue(b.flag(0,0)) self.assertEqual(b.get_mask(0,0), 13) @@ -78,12 +78,12 @@ class TestBoardClass(unittest.TestCase): def test_flag_error_conditions(self): """ liputus ei onnistu jos avattu, alueen ulkopuolella, outo arvo """ b = Board(2,2) - b.tiles=[[1,9],[9,9]] - b.masked[0][0]=6 + b._Board__tiles=[[1,9],[9,9]] + b._Board__masked[0][0]=6 self.assertFalse(b.flag(0,0)) - b.masked[0][0]=10 + b._Board__masked[0][0]=10 self.assertFalse(b.flag(0,0,4)) - b.masked[0][0]=0 + b._Board__masked[0][0]=0 self.assertFalse(b.flag(0,0)) self.assertFalse(b.flag(2,2)) @@ -91,7 +91,7 @@ class TestBoardClass(unittest.TestCase): """ paljastuksen jälkeen näkyy laatat sellaisenaan """ b = Board(2,2) b.reveal() - t = b.tiles + t = b._Board__tiles v = b.get_view() for i in range(2): self.assertEqual(v[i],t[i]) |