예제 #1
0
 def test_getsongs(self):
     l = MusicLibrary()
     self.assertEqual(len(l.getsongs()), 0)
     for x in range(65,90):
         for y in range(65,90):
             for z in range(65,90):
                 l.add(Song(chr(x),chr(y),chr(z)))
     self.assertEqual(len(l.getsongs()), pow(25,3))
예제 #2
0
 def test_massive_song_add(self):
     l = MusicLibrary()
     ix, iy, iz = 0, 0, 0
     for x in range(65,90):
         ix+=1
         for y in range(65,90):
             iy+=1
             for z in range(65,90):
                 iz+=1
                 l.add(Song(chr(x),chr(y),chr(z)))
     self.assertEqual(ix, l.artist_len(), "wrong artist len")
     self.assertEqual(iy, l.album_len(), "wrong album number")
     self.assertEqual(iz, l.song_len(), "wrong song number")
예제 #3
0
 def test_synchronize_list(self):
     mp = Deezer(self.username)
     mp.connect()
     f = open('.\\' + self.username + '_saved_tracks.txt',
              'r',
              encoding='utf8')
     lines = f.readlines()
     f.close()
     music_list = MusicLibrary('vinye_mustaine')
     for line in lines:
         music_list.add(Song(*line.split('\t')))
     print(str(music_list))
     mp.synchronize_list(music_list.getsongs())
     print(str(len(mp.saved_tracks.getsongs())))
예제 #4
0
 def test_massive_song_add2(self):
     username = ''
     f = open('.\\'+ username +'_saved_tracks.txt','r', encoding='utf8')
     lines = f.readlines()
     f.close()
     l = MusicLibrary()
     i = 0
     for x in range(0, len(lines)-1):
         if len(lines[x]) > 0:
             s = Song(*((lines[x]).replace('\n','').split('\t')))
             l.add(s)
             i+=1
             self.assertEqual(i, l.song_len(), "could not add - " + str(i))
             '''try: self.assertEqual(i, l.song_len(), "could not add - " + str(i))
예제 #5
0
 def test_addsong(self):
     lib = MusicLibrary()
     lib.add(self.songs)
     teststr = 'Artists: 2\nAlbums: 3\nSongs: 4'
     self.assertEqual(str(lib), teststr)
예제 #6
0
 def test_addartist(self):
     lib = MusicLibrary()
     lib.add(self.artists)
     teststr = 'Artists: 3\nAlbums: 4\nSongs: 8'
     self.assertEqual(str(lib), teststr)