libsaria: Remove old tests

These files were created for developing small components during initial
design.  I haven't used them in a long time, and most are probably
obsolete by now.
This commit is contained in:
Bryan Schumaker 2011-05-11 22:25:54 -04:00
parent 43b162d007
commit 1ed7e58c99
14 changed files with 0 additions and 314 deletions

View File

@ -1,41 +0,0 @@
#!/usr/bin/python2
# Bryan Schumaker (8/7/2010)
import os
import sys
import datetime
now = datetime.datetime.now
print "Loading libsaria"
before = now()
import libsaria
after = now()
print "libsaria loaded (", after-before, ")"
if len(sys.argv) == 1:
before = now()
libsaria.init()
after = now()
print "startup took", after-before
print
print "Available tests:"
for file in os.listdir("tests"):
split = file.rsplit(".")
if split[1] == "pyc":
continue
if split[0] == "__init__":
continue
print " ", file
for file in sys.argv[1:]:
print
print "=====", file, "====="
print
before = now()
__import__("tests."+file.rsplit(".")[0])
after = now()
print
print "=====", file, "(", after-before,") ====="

View File

@ -1 +0,0 @@

View File

@ -1,24 +0,0 @@
# Bryan Schumaker (8/7/2010)
from libsaria import audio
path = "~/Music/Eagles/Hotel California.mp3"
audio.load(path)
raw_input("Press ENTER to play ... ")
audio.play()
raw_input("Press ENTER to pause ... ")
audio.pause()
raw_input("Press ENTER to play ... ")
audio.play()
raw_input("Press ENTER to stop ... ")
audio.stop()
raw_input("Press ENTER to play ... ")
audio.play()
raw_input("Press ENTER to quit ... ")

View File

@ -1,10 +0,0 @@
# Bryan Schumaker (11/12/2010)
import libsaria
from libsaria import data
from libsaria import sources
from libsaria.path import export
library = libsaria.sources.library
library.load()
export.export()

View File

@ -1,9 +0,0 @@
# Bryan Schumaker (10/23/2010)
import libsaria
cache = libsaria.cache
obj = cache["test"]
#obj = cache["Train"]
#print obj["Save Me, San Francisco.jpg"]

View File

@ -1,12 +0,0 @@
# Bryan Schumaker (8/8/2010)
from libsaria import sources
#src = "~/Music"
#src = "~/Music/Foo Fighters"
#src = "~/Music/Foo Fighters/Foo Fighters"
src = "/media/Music"
sources.new_source(src, bg=False)
#print collection.source.index

View File

@ -1,10 +0,0 @@
# Bryan Schumaker (10/1/2010)
from libsaria import sources
#sources.new_source("~/Desktop")
sources.new_source("~/Music/")
#sources.new_source("/media/Music")
print sources.library.size

View File

@ -1,19 +0,0 @@
# Bryan Schumaker (8/7/2010)
# Use to test the libsaria event system
from libsaria import event
def pre_test(arg=None):
print "pre_test(", arg, ") running"
def post_test(arg=None):
print "post_test(", arg, ") running"
def test(arg=None):
print "test(", arg, ") running"
return False
event.invite("PRETEST", pre_test)
event.invite("POSTTEST", post_test)
event.call("TEST", test, True)

View File

@ -1,14 +0,0 @@
# Bryan Schumake (9/10/2010)
import ocarina
from ocarina import fsselect
def callback(uri):
print uri
fsselect.run_chooser2(callback)
raw_input(">>>")
#print chooser
#chooser = fsselect.make_chooser("Test Chooser", gtk.FILE_CHOOSER_ACTION_OPEN)
#fsselect.run_chooser(chooser)

View File

@ -1,49 +0,0 @@
# Bryan Schumaker (8/7/2010)
# Use to test the Map class provided by libsaria
from libsaria import path
from libsaria.map import Map
key = "key"
# __init__
test = Map()
print "Testing basic functions (no persistance):"
# has
print " Has key <False>?", test.has(key)
# __getitem__
print " test[key] <None>?", test[key]
# __setitem__
print " Setting test[key] = True"
test[key] = True
# has
print " Has key <True>?", test.has(key)
# __getitem__
print " test[key] <True>?", test['key']
print
print "Testing persistance:"
file = path.join(path.join(path.sariadir(),".saria"),"tests.map.pickle")
try:
path.rm(file)
except:
pass
del test
test = Map("tests.map")
test["a"] = 0
test["b"] = 0
print " print test"
print test
print " del test"
del test
print " test = Map(\"tests.map\")"
test = Map("tests.map")
print " print test"
print test
try:
path.rm(file)
except:
pass

View File

@ -1,26 +0,0 @@
# Bryan Schumaker (8/19/2010)
from libsaria import threads
def test(a, b, c):
lock = threads.get_mutex("print")
lock.acquire()
print "a:", a
print "b:", b
print "c:", c
lock.release()
def test2():
lock = threads.get_mutex("print")
lock.acquire()
print "No args!"
lock.release()
a = threads.background(test, 1, 2, 3)
b = threads.background(test2)
if a and a.is_alive():
a.join()
if b.is_alive():
b.join()

View File

@ -1,17 +0,0 @@
# Bryan Schumaker (11/14/2010)
from libsaria import trees
t = trees.get_pref_tree("prefs")
t.disp()
t.set_pref("libsaria.random", True)
t.init_pref("libsaria.a.b", 42)
print t.get_pref("libsaria.random")
print t.get_pref("libsaria.a.b")
t.set_pref("libsaria.random", False)
print t.get_pref("libsaria.random")
t.disp()

View File

@ -1,64 +0,0 @@
# Bryan Schumaker (11/06/2010)
from libsaria import trees
#tree = trees.Tree()
#tree.insert(["home", "bjschuma", "Music"])
#tree.insert(["home", "bjschuma", "Videos"])
#tree.insert(["home", "other", "Music"])
#from libsaria import path
#tree = path.make_tree("/home/bjschuma/Music")
#print tree
#print tree.value
#tree.disp()
#for path in tree.walk():
# print path
#tree = trees.DLTree()
#n = tree.insert(["a", "b", "c", "d"])
#o = tree.insert(["a", "b", "c", "e"])
#p = tree.insert(["f", "g", "h", "i"])
#tree.disp()
#print n.walk_backwards()
#print o.walk_backwards()
#print p.walk_backwards()
#tree = trees.DLFSTree()
#n = tree.insert_path("/a/b/c/d")
#o = tree.insert_path("/a/b/c/e")
#p = tree.insert_path("/f/g/h/i")
#
#for path in tree.walk_paths():
# print path
#
#print n.walk_path_backwards()
#print o.walk_path_backwards()
#print p.walk_path_backwards()
#tree = trees.ValTree()
#tree.insert(["a", "b", "c", "d"], [1, 2, 3, 4])
#tree.insert(["a", "b", "c", "e"], [1, 2, 3, 5])
#tree.insert(["f", "g", "h", "i"], [6, 7, 8, 9])
#tree.disp()
#for vals in tree.walk_vals():
# print vals
tree = trees.DLValTree()
n = tree.insert(["a", "b", "c", "d"], [1, 2, 3, 4])
o = tree.insert(["a", "b", "c", "e"], [1, 2, 3, 5])
p = tree.insert(["f", "g", "h", "i"], [6, 7, 8, 9])
tree.disp()
for path in tree.walk_vals():
print path
print n.walk_backwards()
print n.walk_vals_backwards()
print o.walk_backwards()
print o.walk_vals_backwards()
print p.walk_backwards()
print p.walk_vals_backwards()

View File

@ -1,18 +0,0 @@
# Bryan Schumaker (8/17/2010)
from libsaria import sources
count = 0
list = []
append = list.append
for track in sources.walk_library():
get = track.__getitem__
append([get("id"), get("title"), get("length"),
get("artist"),
get("album"),
get("year"),
get("playcount")])
count += 1
print "Counted: %s files" % count