def test_compare(): song_manager = SongManager(os.path.join('media', 'songs')) song_manager.search() song_manager.verify() song_manager.sort() print "Songs found:" print_song_stats(song_manager) songs = song_manager.songs testdata_songs = pickle_songs(x1) sm2 = SongManager(os.path.join('media', 'songs')) sm2.songs = testdata_songs print "Songs from compare-dump:" print_song_stats(sm2) assert songs == testdata_songs
def dump_songs(dump_file_name, verbose=False): output_file = open(dump_file_name, 'wb') song_manager = SongManager(os.path.join('media', 'songs')) song_manager.search() song_manager.verify() song_manager.sort() songs = song_manager.songs if verbose: print "Testdump from %s songs" % len(songs) pickle.dump(songs, output_file, -1) output_file.close()