ocarina/tests/map.py
Bryan Schumaker 57ec240798 Added event system
I combined various parts of the Ocarina 4.0 event system into one file.
The new event file has threading abilities built in, so I no longer need
an external file for that
2010-08-07 14:23:50 -04:00

50 lines
884 B
Python

# 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