示例#1
0
文件: test_messages.py 项目: gvx/op3
def test_setitem_bundle():
    msg = Bundle(ASAP.now(), Message('/my/test'), Message('/my/test', 1),
                 Message('/my/test', 2))
    msg[2] = Message('/oh/no', b'surprise')
    assert msg == Bundle(ASAP.now(),
                         Message('/my/test'), Message('/my/test', 1),
                         Message('/oh/no', b'surprise'))
示例#2
0
文件: test_messages.py 项目: gvx/op3
def test_bundle():
    assert_roundtrips(
        Bundle(ASAP.now(), Message('/my/test', 333, True),
               Message('/more/tests', "ok")))
    assert_roundtrips(
        Bundle(datetime(2019, 5, 2), Message('/my/test', 333, True),
               Message('/more/tests', "ok")))
    assert_roundtrips(
        Bundle(datetime.now(), Message('/my/test', 333, True),
               Message('/more/tests', "ok")))
    assert_roundtrips(
        Bundle(datetime.now(), Message('/my/test', 333, True),
               Bundle(datetime.now(), Message('/more/tests', "ok"))))
示例#3
0
def test_asap_eq():
    assert ASAP.now() == ASAP(1991, 11, 14)
示例#4
0
def test_asap_repr():
    assert repr(ASAP.now()) == 'ASAP.now()'
示例#5
0
文件: test_messages.py 项目: gvx/op3
def test_message_is_not_bundle():
    assert Message('#bundle') != Bundle(ASAP.now())
示例#6
0
文件: test_messages.py 项目: gvx/op3
def test_weird_stuff_in_bundle():
    with pytest.raises(AssertionError):
        Bundle(ASAP.now(), 'oh no')
示例#7
0
文件: test_messages.py 项目: gvx/op3
def test_asap():
    assert_roundtrips(Message('/my/test', ASAP.now()))
示例#8
0
文件: test_messages.py 项目: gvx/op3
def test_delitem_bundle():
    msg = Bundle(ASAP.now(), Message('/my/test'), Message('/my/test', 1),
                 Message('/my/test', 2))
    del msg[1]
    assert msg == Bundle(ASAP.now(), Message('/my/test'),
                         Message('/my/test', 2))
示例#9
0
文件: test_messages.py 项目: gvx/op3
def test_getitem_bundle():
    assert Bundle(ASAP.now(), Message('/my/test'), Message('/my/test', 1),
                  Message('/my/test', 2))[2] == Message('/my/test', 2)
示例#10
0
文件: test_messages.py 项目: gvx/op3
def test_insert_bundle():
    a = Bundle(ASAP.now(), Message('/my/test'), Message('/hello'))
    b = Bundle(ASAP.now(), Message('/hello'))
    b.insert(0, Message('/my/test'))
    assert a == b