Пример #1
0
 def test_load_dictionary(self):
     """
     test get_dictionary function returns a dictionary
     with its lenght greater than 0
     """
     dictionary = boggle.get_dictionary('words.txt')
     self.assertGreater(len(dictionary), 0)
 def test_load_dictionary(self):
     """
     test that the dict file is >0
     """
     dictionary = boggle.get_dictionary("words.txt")
     self.assertGreater(len(dictionary), 0)
     
Пример #3
0
 def test_load_dictionary(self):
     '''
     Test that the 'get_dictionary' function returns a dictionary
     that has a length greater than 0
     '''
     dictionary = boggle.get_dictionary('words.text')
     self.assertGreater(len(dictionary), 0)
Пример #4
0
 def test_load_dictionary(self):
     """
     Test that the 'get_dictionary' function returns a dictionary 
     that has a length bigger than zero
     """
     dictionary = boggle.get_dictionary('words.txt')
     self.assertGreater(len(dictionary), 0)
Пример #5
0
    def test_load_dictionary(self):

        #test that the 'get_dictionary' function returns a dictionary that has a length > 0

        dictionary = boggle.get_dictionary(
            'words.txt')  #create new file in boggle project called words.txt
        self.assertGreater(len(dictionary), 0)
 def test_load_dictionary(self):
     
     dictionary = boggle.get_dictionary('words.txt')
     self. assertGreater(len(dictionary), 0)
 
     
     
Пример #7
0
    def test_converting_a_path_to_a_word(self):
        """
        Ensure that paths can be converted to words
        """
        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_search_grid_for_words(self)
    """
    Ensure that certain patterns can be found in a path_to_word
    """
    grid = {(0, 0): 'A', (0, 1): 'B', (1, 0): 'C', (1, 1): 'D' }
    twoLetterWord = 'AB'
    threeLetterWord = 'ABC'
    notThereWord = 'EEE'
    fullwords = [twoLetterWord, threeLetterWord, notThereWord]
    stems = ['A', 'AB', 'E', 'EE']
    dictionary = fullwords, stems
    foundWords = boggle.search(grid, dictionary)
    self.assertTrue(twoLetterWord in foundWords)
    self.assertTrue(threeLetterWord in foundWords)
    self.assertTrue(notThereWord not in foundWords)
def test_load_dictionary(self):
    """
    Test that the 'get_dictionary' function returns a dictionary
    that has a length greater than 0
    """
    dictionary = boggle.get_dictionary('words.txt')
    self. assertGreater(len(dictionary), 0)
Пример #8
0
 def test_load_dictionary(self):
     """
     TEST THAT THE get_dictionary FUNCTION RETURNS A
     DICTIONARY THAT HAS A LENGTH GREATER THAN 0
     """
     dictionary = boggle.get_dictionary('words.txt')
     self.assertGreater(len(dictionary), 0)
Пример #9
0
 def test_load_dictionary(self):
     """
     Test case to verify that a list of words returned using get_dictionary()
     is greater than 0
     """
     dictionary = boggle.get_dictionary("words.txt")
     self.assertGreater(len(dictionary), 0)
Пример #10
0
 def test_load_dictionary(self):
     """
     Test That The 'Get_Dictionary' Function Returns A Dictionary
     That Has A Length Greater Than 0
     """
     dictionary = boggle.get_dictionary('words.txt')
     self.assertGreater(len(dictionary), 0)
Пример #11
0
 def test_load_dictionary(self):
     """
      Test that the `get_dictionary` function returns a dictionary
     that has a length greater than 0
     """
     dictionary = boggle.get_dictionary('words.txt')
     self.assertGreater(len(dictionary), 0)
Пример #12
0
    def test_load_dictionary(self):
        '''
        test if the "get_dictionary" function returns a dictionary 
        with a length greater than 0
        '''

        dictionary = boggle.get_dictionary("words.txt")
        self.assertGreater(len(dictionary), 0)
Пример #13
0
 def test_load_dictionary(self):
     '''
     Test that the 'get_dictionary' function returns a dictionary that has
     a length greater than 0
     '''
     # The file name is of a file we will create in our workspace
     # We will get the data from a word file website
     dictionary = boggle.get_dictionary('words.txt')
     self.assertGreater(len(dictionary), 0)
Пример #14
0
 def test_load_dictionary(self):
     #test that the 'get dictionary' function returns a dictionary that has length > 0
     
     dictionary = boggle.get_dictionary('words.txt') #copy/past into words.txt from 
     self.assertGreater(len(dictionary), 0)  #https://www2.cs.duke.edu/courses/spring05/cps100/assign/boggle/code/bogwords.txt
     
     
     
     
     
     
     
     
     
     
     
     
     
     
Пример #15
0
 def test_load_dictionary(self):
     """
     test that the dictionary retuns a dictionary
     """
     dictionary = boggle.get_dictionary('words.txt')
     self.assertGreater(len(dictionary))
Пример #16
0
      notThereWord = 'EEE'
      dictionary = [twoLetterWord, threeLetterWord, notThereWord]
      
      foundWords = boggle.search(grid, dictionary)
      
      self.assertTure(twoLetterWord in foundWords)
      self.assertTrue(threeLetterWord in foundWords)
      self.assertTrue(notThereWord not in foundWords)
  
  
  
   def test_load_dictionary(self)
  """""
   test that 'get dictionary' function returns a dictionary
that has a lenght greather than 0
   """
   dictionary = boggle.get_dictionary('words.txt')
   self.assertGreater(len(dictionary), 0)
   
   
   
   
   
   
   
  
  
  
  
  
  
Пример #17
0
 def test_load_dictionary(self):
     dictionary = boggle.get_dictionary('/usr/share/dict/words')
     self.assertGreater(len(dictionary), 0)
Пример #18
0
 def test_load_dictionary(self):
     """
     Test that the get_dictionary function has a list of words that is greater than 0
     """
     dictionary = boggle.get_dictionary('words.txt')
     self.assertGreater(len(dictionary), 0)
 def test_load_dictionary(self):
     dictionary = boggle.get_dictionary('words.txt')
     self.assertGreater(len(dictionary), 0)
Пример #20
0
 def test_load_dictionary(self):
     dictionary = boggle.get_dictionary(
         '/Users/kenrickhatton/PycharmProjects/untitled/words.txt')
     self.assertGreater(len(dictionary), 0)
Пример #21
0
 def test_load_dictionary(self):
     dictionary = boggle.get_dictionary(
         'C:\\Users\\liam_\\PycharmProjects\\boggle_solver\\words.txt')
     self.assertGreater(len(dictionary), 0)
Пример #22
0
 def test_load_dictionary(self):
     """
     Test that the get dictionary function returns a dictionary and has a lenght greater than 0
     """
     dictionary = boggle.get_dictionary('bogwords.txt')
     self.assertGreater(len(dictionary), 0)
Пример #23
0
 def test_load_dictionary(self):
     """
     Test that the get_dictionary function returns a dictionary
     """
     dictionary = boggle.get_dictionary('words.txt')
     self.assertGreater(len(dictionary), 0)
Пример #24
0
 def test_load_dictionary(self):
     dictionary = boggle.get_dictionary(
         'C:\Users\PNDRCKR\Documents\Stream_2\python\day3\words.txt')
     self.assertGreater(len(dictionary), 0)
class TestBoggle(unittest.TestCase):

    def test_can_create_an_empty_grid(self):
        grid = boggle.make_grid(0, 0)
        self.assertEqual(len(grid), 0)
    
    def test_grid_size_width_times_height(self):
        grid = boggle.make_grid(2, 3)
        self.assertEqual(len(grid), 6)
    
    def test_grid_coordinates(self):
        grid = boggle.make_grid(2, 2)
        self.assertIn((0, 0), grid)
        self.assertIn((0, 1), grid)
        self.assertIn((1, 0), grid)
        self.assertIn((1, 1), grid)
        self.assertNotIn((2, 2), grid)
    
    def test_grid_is_filled_with_letters(self):
        grid = boggle.make_grid(2, 3)
        for letter in grid.values():
            self.assertIn(letter, ascii_uppercase)
    
    def test_neighbours_of_a_position(self):
        coords = (1, 2)
        neighbours = boggle.neighbours_of_position(coords)
        self.assertIn((0, 1), neighbours)
        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)
    

    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) # create a new list from the dictionary's keys
            others.remove(pos)
            self.assertListEqual(sorted(neighbours[pos]), sorted(others))
    
    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_search_grid_for_words(self):
        grid = {(0, 0): 'A', (0, 1): 'B', (1, 0): 'C', (1, 1): 'D'}
        twoLetterWord = 'AB'
        threeLetterWord = 'ABC'
        notThereWord = 'EEE'
        dictionary = [twoLetterWord, threeLetterWord, notThereWord]

        foundWords = boggle.search(grid, dictionary)

        self.assertTrue(twoLetterWord in foundWords)
        self.assertTrue(threeLetterWord in foundWords)
        self.assertTrue(notThereWord not in foundWords)
    
    def test_load_dictionary(self):length greater than 0
        dictionary = boggle.get_dictionary('words.txt')
        self.assertGreater(len(dictionary), 0)
Пример #26
0
 def test_load_dictionary(self):
     dictionary = boggle.get_dictionary(
         '/Users/bimwilliams/PycharmProjects/boggle-machine/words.txt')
     self.assertGreater(len(dictionary), 0)