def test_grid_coordinates(self): grid = boggle.make_grid(2, 2) self.assertTrue((0, 0) in grid) self.assertTrue((0, 1) in grid) self.assertTrue((1, 0) in grid) self.assertTrue((1, 1) in grid) self.assertTrue((2, 2) not in grid)
def test_all_grid_neighbours(self): grid = boggle.make_grid(2, 2) neighbours = boggle.all_grid_neighbours(grid) self.assertEquals(len(neighbours), len(grid)) others = [] for pos in grid: others[:] = grid others.remove(pos) self.assertListEqual(sorted(neighbours[pos]), sorted(others))
def test_grid_size_is_width_times_height(self): grid = boggle.make_grid(2, 3) self.assertEqual(len(grid), 6)
def test_converting_a_path_to_a_word(self): grid = boggle.make_grid(2, 2) oneLetterWord = boggle.path_to_word(grid, [(0, 0)]) twoLetterWord = boggle.path_to_word(grid, [(0, 0), (1, 1)]) self.assertEqual(oneLetterWord, grid[(0, 0)]) self.assertEqual(twoLetterWord, grid[(0, 0)] + grid[(1, 1)])
def test_grid_is_filled_with_letters(self): grid = boggle.make_grid(2, 3) for L in grid.values(): self.assertTrue(L in ascii_uppercase)
def test_can_create_an_empty_grid(self): grid = boggle.make_grid(0, 0) self.assertEqual(len(grid), 0)
def test_can_create_an_empty_grid(self): #this case empty grid no assumptions 4 grid shape or data structure used #test to see if we can create an empty grid grid = boggle.make_grid(0, 0) #height & width or row and column. (0,0) = no rows or columns self.assertEqual(len(grid), 0) #0 x 0 grid has a length of 0
def test_grid_size_is_row_times_Column(self): """ Test is to show that the total size of the grid is equal to width * height """ grid = boggle.make_grid(2, 3) self.assertEqual(len(grid), 6)
def test_can_create_an_empty_grid(self): grid = boggle.make_grid(0, 0) #Here we use the method assertequal which is one of many methods inherited from the testcase class. self.assertEquals(len(grid), 0)
def test_grid_returns_correct_size(self): """ Test case to ensure size of grid returned is correct """ grid = boggle.make_grid(2, 3) self.assertEqual(len(grid), 6)
def test_2x3_grid(self): grid = boggle.make_grid(2,3) self.assertEqual(len(grid),6)
def test_can_create_empty_grid(self): """ Test case for creating an empty grid """ zero_grid = boggle.make_grid(0, 0) self.assertEqual(len(zero_grid), 0)
def test_can_create_an_empty_grid(self): grid = boggle.make_grid(0, 0) self.assertEqual(len(grid), 0, "A grid with no rows or cols has no items")
def test_grid_size_is_width_times_height(self): #test to ensure total size of grid is w x h grid = boggle.make_grid(2, 3) self.assertEqual(len(grid), 6)
def test_can_create_an_empty_grid(self): grid = boggle.make_grid(0, 0) self.assertEquals(len(grid), 0)
def test_grid_size_is_width_times_height(self): # test is to ensure that the total size of the grid is equal to width*heught grid = boggle.make_grid(2, 3) self.assertEquals(len(grid), 6)
def test_grid_size_is_width_times_height(self): grid = boggle.make_grid(2, 3) self.assertEquals(len(grid), 6)
def test_grid_is_filled_with_letters(self): #ensure that each of th e coordinates in the grid contains letters grid = boggle.make_grid(2, 3) for letter in grid.values(): self.assertIn(letter, ascii_uppercase)
def test_can_create_an_empty_grid(self): """ TEst to see if we can create an empty grid """ grid = boggle.make_grid(0, 0) self.assertEqual(len(grid), 0)
def test_converting_a_path_to_a_word(self): grid = boggle.make_grid(2, 2) oneLetterWord = boggle.path_to_word(grid, [(0, 0)]) twoLetterWord = boggle.path_to_word(grid, [(0, 0), (1, 1)]) self.assertEquals(oneLetterWord, grid[(0, 0)]) self.assertEquals(twoLetterWord, grid[(0, 0)] + grid[(1, 1)])
def test_make_grid(self): grid = boggle.make_grid(0, 0) self.assertEqual(len(grid), 0)