示例#1
0
 def test_first_letter_is_constant(self):
     """Every value created should start with the first letter of the
      search input (You are less likely to mess up the first letter
      and not realize it"""
     name = 'ben'
     return_val = utils.all_variations(name)
     for val in return_val:
         assert val[0] == name[0]
示例#2
0
 def test_number_vals_returned(self):
     """for each letter (other than the first letter) there should be
     26 variations for changes in a letter, 26 for adding a letter,
     and 1 for removing the letter, and also add the original input
     giving a total of (len(input) - 1) * 53 + 1 changes """
     name = 'ben'
     return_val = utils.all_variations(name)
     assert len(return_val), (len(name) - 1) * 53 + 1
示例#3
0
 def test_initial_name_present(self):
     """initial name should be returned"""
     name = 'ben'
     return_val = utils.all_variations(name)
     assert name in return_val
示例#4
0
 def test_remove_letter(self):
     """letter can be removed"""
     name = 'ben'
     return_val = utils.all_variations(name)
     assert 'bn' in return_val
示例#5
0
 def test_add_letter(self):
     """Can add letter and still get proper values"""
     name = 'ben'
     return_val = utils.all_variations(name)
     assert 'bean' in return_val
     assert 'baen' in return_val
示例#6
0
 def test_last_letter_changed(self):
     """Last letter can be deleted or changed"""
     name = 'ben'
     return_val = utils.all_variations(name)
     assert 'bek' in return_val
     assert 'be' in return_val
示例#7
0
 def test_singleton_string(self):
     """string of length 1 should return a list consisting of just
     itself"""
     name = 'b'
     return_val = utils.all_variations(name)
     assert return_val == [name]
示例#8
0
 def test_none(self):
     """input = None should return empty list"""
     name = None
     return_val = utils.all_variations(name)
     assert return_val == []
示例#9
0
 def test_empty_string(self):
     """empty string should return empty list"""
     name = ''
     return_val = utils.all_variations(name)
     assert return_val == []