Skip to content

Commit

Permalink
added some tests for local plugs
Browse files Browse the repository at this point in the history
  • Loading branch information
plamere committed Feb 17, 2016
1 parent 3a9456b commit 5eb558d
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions server/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -*- coding: latin-1 -*-
import pbl
import unittest
import pprint

from pbl import engine,Dumper
from plugs import *

silent_running = True

def runner(source, max_tracks = 100, props=[]):
if not silent_running:
pipeline = source
else:
pipeline = pbl.Dumper(source, props)
return engine.run_source(pipeline, max_tracks)

class TestPlugs(unittest.TestCase):

def test_artist_dedup(self):
print 'with dedup'
src = pbl.PlaylistSource("extender test", None, 'plamere')
src = ArtistDeDup(src)
de_dup_size = runner(src, 500)

src = pbl.PlaylistSource("extender test", None, 'plamere')
undup_size = runner(src, 500)
assert de_dup_size < undup_size

def test_artist_separation(self):
src = pbl.PlaylistSource("extender test", None, 'plamere')
runner(src, 500)

src = pbl.PlaylistSource("extender test", None, 'plamere')
asep = ArtistSeparation(src, 4, True)
runner(asep, 500)

def test_artist_separation2(self):
src = pbl.PlaylistSource("extender test", None, 'plamere')
asep = ArtistSeparation(src, 4, False)
runner(asep, 500)

if __name__ == '__main__':
unittest.main()

0 comments on commit 5eb558d

Please sign in to comment.