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]
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
def test_initial_name_present(self): """initial name should be returned""" name = 'ben' return_val = utils.all_variations(name) assert name in return_val
def test_remove_letter(self): """letter can be removed""" name = 'ben' return_val = utils.all_variations(name) assert 'bn' in return_val
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
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
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]
def test_none(self): """input = None should return empty list""" name = None return_val = utils.all_variations(name) assert return_val == []
def test_empty_string(self): """empty string should return empty list""" name = '' return_val = utils.all_variations(name) assert return_val == []