Closed bronisze closed 7 years ago
@pytest.fixture(scope = 'session') def FixedBytes(): class FixedBytes(prophy.with_metaclass(prophy.struct_generator, prophy.struct_packed)): _descriptor = [("value", prophy.bytes(size = 5))] return FixedBytes
def test_fixed_bytes_assignment(FixedBytes): x = FixedBytes() x.value = b"\x00\x00\x00\x00\xaa" str(x)
result:
x = b'\x00\x00\x00\x00\xaa'
def b(x):
return x.decode() E UnicodeDecodeError: 'utf-8' codec can't decode byte 0xaa in position 4: invalid start byte
return x.decode()
E UnicodeDecodeError: 'utf-8' codec can't decode byte 0xaa in position 4: invalid start byte
Bug solved after 568 days :)
@pytest.fixture(scope = 'session') def FixedBytes(): class FixedBytes(prophy.with_metaclass(prophy.struct_generator, prophy.struct_packed)): _descriptor = [("value", prophy.bytes(size = 5))] return FixedBytes
def test_fixed_bytes_assignment(FixedBytes): x = FixedBytes() x.value = b"\x00\x00\x00\x00\xaa" str(x)
result:
x = b'\x00\x00\x00\x00\xaa'