Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (20 sloc) 626 Bytes
import as nt
from protocol.lut import Lut
def test_lut_lambda():
# make a lookup table, register a random-ass function, get it back and
# make sure it works.
lut = Lut()
key = lut.register(lambda x: x+1)
fxn = lut.lookup(key)
nt.assert_equal(fxn(1), 2)
nt.assert_equal(fxn(2), 3)
def test_lut_method():
# make a lut, register a method and make sure you can get it *by name*.
class Test(object):
def ping(self, cb):
test = Test()
lut = Lut()
key = lut.register(
nt.assert_equal(key, 'ping')
fxn = lut.lookup(key)
Jump to Line
Something went wrong with that request. Please try again.