示例#1
0
 class Something:
     a: N(10)
     b: AN(20)
     other: Other
     others: List[Other]
     c: N(5)
     d: AN(10)
示例#2
0
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)
示例#3
0
def test_N_to_bytes_with_filler(length, filler, value, expected):
    assert N(length, filler=filler).to_bytes(value) == expected
示例#4
0
def test_N_to_bytes(length, value, expected):
    assert N(length).to_bytes(value) == expected
示例#5
0
 class Other:
     an: AN(10)
     n: N(5)
示例#6
0
 class Something:
     n: N(1)
示例#7
0
 class Other:
     n: N(5)
     an: AN(10)
示例#8
0
 class Something:
     n: N(10)
     an: AN(20)
     other: Other
     others: List[Other]
     filler: AN(100)