Esempio n. 1
0
 def test_all_grid_neighbours(self):
     grid = boggle.make_grid(2, 2)
     neighbours = boggle.all_grid_neighbours(grid)
     self.assertEqual(len(neighbours), len(grid))
     for pos in grid:
         others = list(grid)  #Crea lista con las claves del dicionario
         others.remove(pos)
         self.assertListEqual(sorted(neighbours[pos]), sorted(others))
Esempio n. 2
0
 def test_all_grid_neighbours(self):
     grid = boggle.make_grid(2, 2)
     neighbours = boggle.all_grid_neighbours(grid)
     self.assertEqual(len(neighbours), len(grid))
     for pos in grid:
         others = list(grid)
         others.remove(pos)
         self.assertListEqual(sorted(neighbours[pos]), sorted(others))
def test_all_grid_neighbours(self):
    grid = boggle.make_grid(2, 2)
    neighbours = boggle.all_grid_neighbours(grid)
    self.assertEquals(len(neighbours), len(grid))
    for pos in grid:
        others = list(grid)  # creates a new list from the dictionary's keys
        others.remove(pos)
        self.assertListEqual(sorted(neighbours[pos]), sorted(others))
Esempio n. 4
0
 def test_all_grid_neighbours(self):
     # ensure all grid positions have neighbours
     grid = boggle.make_grid(2, 2)
     neighbours = boggle.all_grid_neighbours(grid)
     self.assertEqual(len(neighbours), len(grid))
     for pos in grid:
         others = list(grid)  #creates list from dictionarie's keys
         others.remove(pos)
         self.assertListEqual(sorted(neighbours[pos]), sorted(others))
 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))
Esempio n. 6
0
 def test_all_grid_neighbours(self):
     """
     Ensure that all of the grid positions have neighbours
     """
     grid = boggle.make_grid(2, 2)
     neighbours = boggle.all_grid_neighbours(grid)
     self.assertEqual(len(neighbours), len(grid))
     for pos in grid:
         others = list(grid)  #creates a new list from the dictionary's keys
         others.remove(pos)
Esempio n. 7
0
 def test_all_grid_neighbours(self):
     # Ensure that all of the grid positions have neighbors
     grid = boggle.make_grid(2, 2)
     neighbors = boggle.all_grid_neighbours(grid)
     self.assertEqual(len(neighbors), len(grid))
     for pos in grid:
         # Creates a new list from the dictionary's keys
         others = list(grid)
         others.remove(pos)
         self.assertListEqual(sorted(neighbours[pos]), sorted(others))
Esempio n. 8
0
 def test_all_grid_neighbours(self):
     """
     ensure that all grid positions have neighbours
     """
     grid = boggle.make_grid(2, 2)
     neighbours = boggle.all_grid_neighbours(grid)
     self.assertEqual(len(neighbours), len(grid))
     for pos in grid:
         others = list(grid)  #creates new list
         others.remove(pos)
         self.assertEqual(sorted(neighbours[pos]), sorted(others))
Esempio n. 9
0
 def test_all_grid_neighbours(self):
     #ensure all grid positions have neighbours
     
     grid = boggle.make_grid(2, 2)
     neighbours = boggle.all_grid_neighbours(grid) #get all neighbours 4 grid.
                              #is a dictionary where key is position and value is list of neighbouring positions
     self.assertEqual(len(neighbours), len(grid)) #assert correct length of neighbours dictionary
     for pos in grid:      #for loop iterates through positions in grid. for each pos neigh are other 3 positions
         others = list(grid) #creates new list from the dictionaries keys. this is full list
         others.remove(pos) #minus position in question
         self.assertListEqual(sorted(neighbours[pos]), sorted(others)) #asserts pos neigh are pos being checked
Esempio n. 10
0
 def test_all_grid_neighbours(self):
     """
     ENSURE THAT ALL THE GRID POSITIONS HAVE NEIGHBOURS
     """
     grid = boggle.make_grid(2, 2)
     neighbours = boggle.all_grid_neighbours(grid)
     self.assertEqual(len(neighbours), len(grid))
     for pos in grid:
         others = list(grid)  # CREATES A NEW LIST FROM DICTIONARY'S KEYS
         others.remove(pos)
         self.assertListEqual(sorted(neighbours[pos]), sorted(others))
Esempio n. 11
0
 def test_all_grid_neighbours(self):
     """
     Ensure that all of the grid positions have neighbours
     """
     grid = boggle.make_grid(2, 2)
     neighbours = boggle.all_grid_neighbours(grid)
     self.assertEqual(len(neighbours), len(grid))
     for pos in grid:
         others = list(grid) # Creates a new list from the dictionary's keys
         others.remove(pos) # Removes the position in question
         # Asserts that the positions are the neighbours of the position being checked
         self.assertListEqual(sorted(neighbours[pos]), sorted(others))
Esempio n. 12
0
 def test_all_grid_neighbours(self):
     """
     Ensure That All Of The Grid Positions Have Neighbours
     """
     grid = boggle.make_grid(2, 2)
     neighbours = boggle.all_grid_neighbours(grid)
     self.assertEqual(len(neighbours), len(grid))
     for pos in grid:
         others = list(
             grid)  # Creates A New List From The Dictionary's Keys
         others.remove(pos)
         self.assertListEqual(sorted(neighbours[pos]), sorted(others))
Esempio n. 13
0
 def test_all_grid_neighbours(self):
     """
     Test case to verify all grid positions have neighbours
     """
     grid = boggle.make_grid(2, 2)
     neighbours = boggle.all_grid_neighbours(grid)
     self.assertEqual(len(grid), len(neighbours))
     for position in grid:
         adjacents = list(grid)
         # Remove the current grid position to leave only the adjacent positions
         adjacents.remove(position)
         self.assertListEqual(sorted(neighbours[position]),
                              sorted(adjacents))
Esempio n. 14
0
 def test_all_grid_neighbours(self):
     """
     Ensure that all of the grid positions have neighbours
     """
     grid = boggle.make_grid(2, 2)
     neighbours = boggle.all_grid_neighbours(grid)
     self.assertEqual(len(neighbours), len(grid))  # ???????
     for pos in grid:  # ex. [0, 0]
         others = list(
             grid)  # creates a new list from the dictionary's keys
         # [[0, 0], [0, 1], [1, 0], [1, 1]]
         others.remove(pos)  # minus questioning position [0,0]
         self.assertListEqual(sorted(neighbours[pos]), sorted(others))
Esempio n. 15
0
 def test_all_the_grid_neighbours(self):
     """
     Ensure that all of the grid positions have neighbours
     """
     grid = boggle.make_grid(2, 2)
     neighbours = boggle.all_grid_neighbours(grid)
     self.assertEqual(len(neighbours), len(grid))
     for pos in grid:
         others = list(grid)  # create a new list from the dictionary's keys
         # for each position the neighbors are the other three positions on the grid so we create the
         #others list which is a full grid minus (-) the positioning question
         others.remove(pos)
         self.assertListEqual(sorted(neighbours[pos]), sorted(others))
Esempio n. 16
0
    def test_all_grid_neighbours(self):
        """
        Ensure that all of the grid positions have neighbours
        """

        #The self.assertEqual here tests for equality

        grid = boggle.make_grid(2, 2)
        neighbours = boggle.all_grid_neighbours(grid)
        self.assertEqual(len(neighbours), len(grid))
        for position in grid:
            others = list(grid)  #creates a new list from the dictionares keys
            others.remove(position)
            self.assertListEqual(sorted(neighbours[position]), sorted(others))
Esempio n. 17
0
 def test_all_grid_neighbours(self):
     """
     Ensure that all of the grid positions have neighbours
     """
     grid = boggle.make_grid(2, 2)
     neighbours = boggle.all_grid_neighbours(
         grid)  # This is a dictionary where the key is a position
     self.assertEqual(
         len(neighbours), len(grid)
     )  # just like with the grid itself but the value is a list of neighboring positions. This next line can assert the correct length of the neighbors dictionary
     for pos in grid:
         others = list(grid)  # create a new list from the dictionary's keys
         others.remove(pos)
         self.assertListEqual(sorted(neighbours[pos]), sorted(others))
Esempio n. 18
0
 def test_all_grid_neighbours(self):
     '''
     Ensure that all of the grid positions have neighbours (this accounts for the edge and corner pieces)
     In (2,2) grid, every position touches every other position, so the neighbours of any position are other three positions in the grid
     '''
     grid = boggle.make_grid(2, 2)
     # We get all the neighbours for the grid - dictionary where key is the position but value is list of neighbouring positions
     neighbours = boggle.all_grid_neighbours(grid)
     # Asserts the length of the neighbours dictionary, which should be equal to the grid length
     self.assertEqual(len(neighbours), len(grid))
     # The for loop iterates through the other positions - we create the others list, which is the full grid minus the current position
     for pos in grid:
         others = list(grid)
         others.remove(pos)
         self.assertListEqual(sorted(neighbours[pos]), sorted(others))
Esempio n. 19
0
    def test_all_grid_neighbours(self):

        #ensure that all grid positions have neighbours

        grid = boggle.make_grid(2, 2)
        neighbours = boggle.all_grid_neighbours(grid)
        self.assertEqual(
            len(neighbours),
            len(grid))  #assert correct length of neighbours dictionary
        for pos in grid:  #for loop will iterate through positions in the grid
            others = list(
                grid)  #creates a new list from dictionarys keys. full list
            others.remove(pos)  #minus position in question
            self.assertListEqual(
                sorted(neighbours[pos]),
                sorted(others))  # asserts position of neighbours is
Esempio n. 20
0
    def test_all_grid_neighbours(self):
        """
        Ensure that all of the grid positions have neighbours. 
        Creation of 2 x 2 grid allows for all grid spaces to be captured
        within the overall 3 x 3 grid. Upto x4 of (2x2) grids in overall
        3 x 3 grid
        """

        grid = boggle.make_grid(2, 2)
        neighbours = boggle.all_grid_neighbours(grid)
        self.assertEqual(len(neighbours), len(grid))
        for pos in grid:
            others = list(
                grid)  # Creates a new list from the dictionaries keys
            others.remove(pos)
            self.assertListEqual(sorted(neighbours[pos]), sorted(
                others))  # Asserts the positions of neighbours being checked.
Esempio n. 21
0
 def test_all_grid_neighbours(self):
     """
     Ensure that all of the grid have neighbours
     """
     grid = boggle.make_grid(2, 2)
     neighbours = boggle.all_grid_neighbours(
         grid)  #get all neighbours of a grid
     self.assertEqual(
         len(neighbours),
         len(grid))  #assert the correct length of neighbours dict
     for pos in grid:  #iterate through the positions in the grid for each position
         others = list(grid)  # create a new list from the dictionary's keys
         others.remove(
             pos
         )  # thus we create the full grid but remove the pos to show the neighbours only
         self.assertListEqual(
             sorted(neighbours[pos]), sorted(others)
         )  #the positions of the neighbours are the positions being checked
Esempio n. 22
0
 def test_all_grid_neighbours(self):
     """
     Ensure that all of the grid positions have neighbours
     """
     grid = boggle.make_grid(
         2, 2
     )  #Grid variable, makes a 2 x 2 grid (Neighbours of any position are the other two positions in the grid)
     neighbours = boggle.all_grid_neighbours(grid)  #Creates a dictionary
     self.assertEqual(len(neighbours), len(
         grid))  #Asserts the correct length of the neighbours dictionary.
     for pos in grid:  #For loop iterates through the grid.
         others = list(
             grid
         )  #Creates a list which is the full grid minus the position in question.
         others.remove(
             pos)  #Removes the position in question from the others list.
         self.assertListEqual(
             sorted(neighbours[pos]), sorted(others)
         )  #Asserts that the positions are the neighbours of the position being checked.
Esempio n. 23
0
 def test_all_grid_neighbours(self):
     grid = boggle.make_grid(2, 2)
     neighbours = boggle.all_grid_neighbours(grid)
     self.assertEqual(len(neighbours), len(grid))