Пример #1
0
 def test_turn_to_valid_filename(self):
     non_valid_filename = 'this_is-a n!@#$%^&*on() valid filename.ext'
     self.assertEqual('this_is-a non valid filename.ext', string_utils.turn_to_valid_filename(non_valid_filename))
Пример #2
0
def load_shows(show_names):
    shows = []
    for show_name in show_names:
        with open (string_utils.turn_to_valid_filename(show_name)+'.show', 'r+') as f:
            shows.append(pickle.load(f))
    return shows
Пример #3
0
 def test_turn_to_valid_filename_can_accept_exceptions(self):
     non_valid_filename = 'this_is-a n!@#$%^&*on() valid filename.ext'
     self.assertEqual('this_is-a non() valid filename.ext', string_utils.turn_to_valid_filename(non_valid_filename, accept_as_valid='()'))
Пример #4
0
 def pickle(self):
     with open(string_utils.turn_to_valid_filename(self.name)+'.show', 'w+') as f:
         pickle.dump(self, f)