Пример #1
0
 def test_neighbours_of_a_position(self):
     neighbours = boggle.neighbours_of_a_position((1, 2))
     self.assertTrue((0, 1) in neighbours)
     self.assertTrue((0, 2) in neighbours)
     self.assertTrue((0, 3) in neighbours)
     self.assertTrue((1, 1) in neighbours)
     self.assertTrue((1, 3) in neighbours)
     self.assertTrue((2, 1) in neighbours)
     self.assertTrue((2, 2) in neighbours)
     self.assertTrue((2, 3) in neighbours)
Пример #2
0
def test_neighbours_of_a_position(self):
    #ensure that a position has eight neighbours
    
    coords = (1, 2)
    neighbours = boggle.neighbours_of_a_position(coords)
    self.assertIn((0, 1), neighbours)
    self.assertIn((0, 2), neighbours)
    self.assertIn((0, 2), neighbours)
    self.assertIn((1, 1), neighbours)
    self.assertIn((1, 3), neighbours)
    self.assertIn((2, 1), neighbours)
    self.assertIn((2, 2), neighbours)
    self.assertIn((2, 3), neighbours)
Пример #3
0
 def test_neighbours_of_a_position(self):
     """
     Ensure that a position has 8 neighbours
     """
     coords = (1, 2)  #Variable coords set to (1, 2)
     neighbours = boggle.neighbours_of_a_position(
         coords)  #Neighbours variable calls function from boggle.py
     self.assertIn((0, 1), neighbours)  #Tests positions on the grid
     self.assertIn((0, 2), neighbours)
     self.assertIn((0, 3), neighbours)
     self.assertIn((1, 1), neighbours)
     self.assertIn((1, 3), neighbours)
     self.assertIn((2, 1), neighbours)
     self.assertIn((2, 2), neighbours)
     self.assertIn((2, 3), neighbours)