Ejemplo n.º 1
0
 def test_create_small_collection(self):
     number = 30
     files = self.__filter_audio_files(TEST_AUDIO_DIR)
     presets = ['music', 'lowlevel', 'rhythm']
     can_files = []
     c = Collection.create_collection('test_coll')
     for _ in xrange(number):
         f = File.create_file(choice(files), temporary=False)
         c.add_file(f)
         can_files.append(f)
     successful_searches = 0
     while True:
         try:
             c.get_similar(choice(can_files), choice(presets), 20)
             successful_searches += 1
             sys.stdout.write('+')
             sys.stdout.flush()
             if successful_searches > 100:
                 break
         except CanorisException, e:
             # 409 when the collection isn't ready yet
             # 404 when the file wasn't yet analyzed
             if e.code == 409 or (e.code == 404 and e.type == "NotReadyYet"):
                 sys.stdout.write(',')
                 sys.stdout.flush()
                 time.sleep(1)
             else:
                 raise e
Ejemplo n.º 2
0
 def test_create_delete_collection(self):
     c = Collection.create_collection('test_coll')
     assert(c['name'] == 'test_coll')
     c.delete()