Beispiel #1
0
 class User(Message):
     name: str = String(number=1)
Beispiel #2
0
 class UserV2(Message):
     name: str = String(number=1)
     x: int = Int32(number=2)
Beispiel #3
0
 def test_invalid_input(self, invalid_input):
     with pytest.raises(ValueError):
         String(number=1).validate_value(invalid_input)
Beispiel #4
0
 def test_valid_input(self, valid_input):
     String(number=1).validate_value(valid_input)
Beispiel #5
0
    def test_decode(self, value, expected_value):
        stream = io.BytesIO(value)

        assert String(number=1).decode(stream) == expected_value
Beispiel #6
0
 def test_encode(self, value, expected_value):
     assert String(number=1).encode_value(value) == expected_value