コード例 #1
0
def test_read_options():
    data = io.BytesIO(b'\x00\x01\x00\x0cHello world!'
                      b'\x00\x01\x00\x0fSpam eggs bacon\x00'
                      b'\x00\x02\x00\x0fSome other text\x00'
                      b'\x00\x00\x00\x00')

    options = read_options(data, '>')
    assert options == [
        (1, b'Hello world!'),
        (1, b'Spam eggs bacon'),
        (2, b'Some other text'),
    ]
コード例 #2
0
ファイル: test_structs.py プロジェクト: rshk/python-pcapng
def test_read_options():
    data = io.BytesIO(
        b'\x00\x01\x00\x0cHello world!'
        b'\x00\x01\x00\x0fSpam eggs bacon\x00'
        b'\x00\x02\x00\x0fSome other text\x00'
        b'\x00\x00\x00\x00')

    options = read_options(data, '>')
    assert options == [
        (1, b'Hello world!'),
        (1, b'Spam eggs bacon'),
        (2, b'Some other text'),
    ]
コード例 #3
0
def test_read_options():
    data = io.BytesIO(
        b"\x00\x01\x00\x0cHello world!"
        b"\x00\x01\x00\x0fSpam eggs bacon\x00"
        b"\x00\x02\x00\x0fSome other text\x00"
        b"\x00\x00\x00\x00"
    )

    options = read_options(data, ">")
    assert options == [
        (1, b"Hello world!"),
        (1, b"Spam eggs bacon"),
        (2, b"Some other text"),
    ]
コード例 #4
0
ファイル: test_structs.py プロジェクト: sim0nx/python-pcapng
def test_read_options_2():
    data = io.BytesIO(
        '\x00\x01\x00\x0e''Just a comment\x00\x00'
        '\x00\x02\x00\x0b''My Computer\x00'
        '\x00\x03\x00\x05''My OS\x00\x00\x00'
        '\x00\x04\x00\x0a''A fake app\x00\x00'
        "\x00\x00\x00\x00")

    options = read_options(data, '>')
    assert options == [
        (1, 'Just a comment'),
        (2, 'My Computer'),
        (3, 'My OS'),
        (4, 'A fake app'),
    ]
コード例 #5
0
ファイル: test_structs.py プロジェクト: rshk/python-pcapng
def test_read_options_2():
    data = io.BytesIO(
        b'\x00\x01\x00\x0e'b'Just a comment\x00\x00'
        b'\x00\x02\x00\x0b'b'My Computer\x00'
        b'\x00\x03\x00\x05'b'My OS\x00\x00\x00'
        b'\x00\x04\x00\x0a'b'A fake app\x00\x00'
        b"\x00\x00\x00\x00")

    options = read_options(data, '>')
    assert options == [
        (1, b'Just a comment'),
        (2, b'My Computer'),
        (3, b'My OS'),
        (4, b'A fake app'),
    ]
コード例 #6
0
def test_read_options_2():
    data = io.BytesIO(
        b'\x00\x01\x00\x0e'b'Just a comment\x00\x00'
        b'\x00\x02\x00\x0b'b'My Computer\x00'
        b'\x00\x03\x00\x05'b'My OS\x00\x00\x00'
        b'\x00\x04\x00\x0a'b'A fake app\x00\x00'
        b"\x00\x00\x00\x00")

    options = read_options(data, '>')
    assert options == [
        (1, b'Just a comment'),
        (2, b'My Computer'),
        (3, b'My OS'),
        (4, b'A fake app'),
    ]
コード例 #7
0
def test_read_options_2():
    data = io.BytesIO(
        b"\x00\x01\x00\x0e"
        b"Just a comment\x00\x00"
        b"\x00\x02\x00\x0b"
        b"My Computer\x00"
        b"\x00\x03\x00\x05"
        b"My OS\x00\x00\x00"
        b"\x00\x04\x00\x0a"
        b"A fake app\x00\x00"
        b"\x00\x00\x00\x00"
    )

    options = read_options(data, ">")
    assert options == [
        (1, b"Just a comment"),
        (2, b"My Computer"),
        (3, b"My OS"),
        (4, b"A fake app"),
    ]