class Something: a: N(10) b: AN(20) other: Other others: List[Other] c: N(5) d: AN(10)
def test_N_to_bytes_with_invalid_length(length, value): with pytest.raises(InvalidLengthError) as e: assert N(length).to_bytes(value) assert 'Invalid length of value is given' in str(e.value)
def test_N_to_bytes_with_filler(length, filler, value, expected): assert N(length, filler=filler).to_bytes(value) == expected
def test_N_to_bytes(length, value, expected): assert N(length).to_bytes(value) == expected
class Other: an: AN(10) n: N(5)
class Something: n: N(1)
class Other: n: N(5) an: AN(10)
class Something: n: N(10) an: AN(20) other: Other others: List[Other] filler: AN(100)