示例#1
0
def test_list_class_lookup_all():
    reg1 = Registry()
    reg2 = Registry()

    reg1.register(target, (), 'reg1')
    reg2.register(target, (), 'reg2')

    lookup = ListClassLookup([reg1, reg2])
    assert list(lookup.all(target, ())) == ['reg1', 'reg2']
示例#2
0
def test_list_class_lookup():
    reg1 = Registry()
    reg2 = Registry()

    reg2.register(target, (), 'reg2 component')

    lookup = ListClassLookup([reg1, reg2])
    assert lookup.get(target, ()) == 'reg2 component'

    reg1.register(target, (), 'reg1 component')
    assert lookup.get(target, ()) == 'reg1 component'
示例#3
0
def test_list_class_lookup_not_found():
    reg1 = Registry()
    reg2 = Registry()

    lookup = ListClassLookup([reg1, reg2])
    assert lookup.get(target, ()) is None