Exemplo n.º 1
0
def test_read_boundary_case1():
    img = Image(Section(data=bytearray(5), start_address=0x1000))
    assert img.read(0x1000, 5) == b"\x00\x00\x00\x00\x00"
Exemplo n.º 2
0
def test_read_boundary_case3():
    img = Image(Section(data=bytearray(5), start_address=0x1000))
    with pytest.raises(InvalidAddressError):
        img.read(0x0fff, 5)
Exemplo n.º 3
0
def test_read_write():
    img = Image(Section(data=bytearray(32), start_address=0x1000))
    img.write(0x1000, b'hello')
    assert img.read(0x1000, 5) == b"hello"