예제 #1
0
파일: test_messages.py 프로젝트: gvx/op3
def test_adding_tuples():
    a = Message('/my/test', 1)

    b = Message('/my/test')
    b.append(1, tag='i')

    c = Message('/my/test')
    c.append((1, 'i'))

    assert a == b == c
예제 #2
0
파일: test_messages.py 프로젝트: gvx/op3
def test_float_roundtrips():
    assert_roundtrips(
        Message(
            '/my/test', *[
                Element(x, tag='d')
                for x in (10.0, 0.5, 12345.6789, math.pi, math.inf, -math.inf)
            ]))
예제 #3
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'))
예제 #4
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"))))
예제 #5
0
파일: test_messages.py 프로젝트: gvx/op3
def test_blob_roundtrips():
    assert_roundtrips(Message('/my/test', b"hello"))
예제 #6
0
파일: test_messages.py 프로젝트: gvx/op3
def test_bool_roundtrips():
    assert_roundtrips(Message('/my/test', True, False))
예제 #7
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
예제 #8
0
파일: test_messages.py 프로젝트: gvx/op3
def test_message_is_not_bundle():
    assert Message('#bundle') != Bundle(ASAP.now())
예제 #9
0
파일: test_messages.py 프로젝트: gvx/op3
def test_midi_roundtrips():
    assert_roundtrips(Message('/my/test', MIDIMessage(1, 2, 3, 4)))
예제 #10
0
파일: test_messages.py 프로젝트: gvx/op3
def test_character_roundtrips():
    assert_roundtrips(Message('/my/test', Element(ord('O'), 'c')))
    assert parse(bytes(Message('/my/test', Element('O', 'c')))) == Message(
        '/my/test', Element(ord('O'), 'c'))
예제 #11
0
파일: test_messages.py 프로젝트: gvx/op3
def test_asap():
    assert_roundtrips(Message('/my/test', ASAP.now()))
예제 #12
0
파일: test_messages.py 프로젝트: gvx/op3
def test_setitem():
    msg = Message('/my/test', 'a', 'b', 'c')
    msg[2] = 100
    assert msg == Message('/my/test', 'a', 'b', 100)
예제 #13
0
파일: test_messages.py 프로젝트: gvx/op3
def test_clear():
    msg = Message('/my/test', 'a', 'b', 'c')
    assert len(msg) == 3
    msg.clear()
    assert len(msg) == 0
예제 #14
0
파일: test_messages.py 프로젝트: gvx/op3
def test_none_roundtrips():
    assert_roundtrips(Message('/my/test', None))
예제 #15
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))
예제 #16
0
파일: test_messages.py 프로젝트: gvx/op3
def test_delitem():
    msg = Message('/my/test', 'a', 'b', 'c')
    del msg[1]
    assert msg == Message('/my/test', 'a', 'c')
예제 #17
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)
예제 #18
0
파일: test_messages.py 프로젝트: gvx/op3
def test_datetime_roundtrips2():
    assert_roundtrips(Message('/my/test', datetime(2019, 10, 2)))
예제 #19
0
파일: test_messages.py 프로젝트: gvx/op3
def test_bundle2():
    timetag = datetime(2019, 9, 17, 21, 49, 43, 677925)
    assert_roundtrips(
        Bundle(timetag, Message('/some/test', 1),
               Message('/some/test', 2, timetag)))
예제 #20
0
파일: test_messages.py 프로젝트: gvx/op3
def test_datetime_roundtrips3():
    assert_roundtrips(Message('/my/test', datetime(2019, 10, 2, 21, 9, 8)))
예제 #21
0
파일: test_messages.py 프로젝트: gvx/op3
def test_getitem():
    assert Message('/my/test', 'a', 'b', 'c')[2] == Element.from_pair('c')
예제 #22
0
파일: test_messages.py 프로젝트: gvx/op3
def test_float32_roundtrips():
    assert_roundtrips(Message('/my/test', 10.0, 0.5, math.inf, -math.inf))
예제 #23
0
파일: test_messages.py 프로젝트: gvx/op3
def test_values():
    assert list(Message('/my/test', 10, True,
                        "Buffalo").values()) == [10, True, "Buffalo"]
예제 #24
0
파일: test_messages.py 프로젝트: gvx/op3
def test_rgba_roundtrips():
    assert_roundtrips(Message('/my/test', RGBA(255, 128, 0, 100)))
예제 #25
0
파일: test_messages.py 프로젝트: gvx/op3
def test_str_roundtrips():
    assert_roundtrips(Message('/my/test', "hello"))
예제 #26
0
파일: test_messages.py 프로젝트: gvx/op3
def test_insert():
    a = Message('/my/test', 10, 20)
    b = Message('/my/test', 20)
    b.insert(0, 10)
    assert a == b
예제 #27
0
파일: test_messages.py 프로젝트: gvx/op3
def test_empty_message_roundtrips():
    assert_roundtrips(Message('/my/test'))