Beispiel #1
0
def test_bunch_set_get():
    b = Bunch(c=42, a=3, b='44', _a=0)
    assert b.c == 42
    assert b['c'] == 42
    b.c = 17
    assert b.c == 17
    b['c'] = 18
    assert b.c == 18
    assert 'c' in b
def test_bunch_set_get():
    b = Bunch( c=42, a=3, b='44', _a=0)
    assert b.c == 42
    assert b['c'] == 42
    b.c = 17
    assert b.c == 17
    b['c'] = 18
    assert b.c == 18
    assert 'c' in b
Beispiel #3
0
def test_bunch_token():
    b = Bunch(c=42, a=3, b='44', _a=0)
    tok = b._token()
    b.validate_token(tok)
    assert tok == 'e4f4206e'
    with raises(Exception):
        b.validate_token('123456')
def test_bunch_token():
    b = Bunch(c=42, a=3, b='44', _a=0)
    tok = b._token()
    b.validate_token(tok)
    assert tok == 'e4f4206e'
    with raises(Exception):
        b.validate_token('123456')
Beispiel #5
0
def test_bunch_update():
    b = Bunch(c=42, a=3, b='44', _a=0)
    d = dict(_a=1, a=2, b=3, c=4, extra=5)
    b.update(d)
    assert b.a == 2 and b.c == 4
def test_bunch_update():
    b = Bunch(c=42, a=3, b='44', _a=0)
    d = dict(_a=1, a=2, b=3, c=4, extra=5)
    b.update(d)
    assert b.a == 2 and b.c == 4