Пример #1
0
def test_round_trip_parse():
    m1 = E(
        data='hi there\nsexy developer',
        event='salutation',
        id='abcdefg',
        retry=10000
    )

    dumped = m1.dump()
    m2 = E.parse(dumped)
    assert m1.id == m2.id
    assert m1.data == m2.data
    assert m1.retry == m2.retry
    assert m1.event == m2.event
Пример #2
0
def test_default_event():
    m = E.parse('data: blah')
    assert m.event == 'message'
Пример #3
0
def test_retry_is_integer():
    m = E.parse('data: hi\nretry: 4000')
    assert m.retry == 4000
Пример #4
0
def test_comment():
    raw = ":this is a comment\ndata: this is some data"
    m = E.parse(raw)
    assert m.data == 'this is some data'
Пример #5
0
def test_no_space():
    m = E.parse('data:hi')
    assert m.data == 'hi'
Пример #6
0
def test_no_colon():
    m = E.parse('data')
    assert m.data == ''