Esempio n. 1
0
    def test_alignment(self):
        """Test field formats that are valid ElementString elements."""
        TestStruct = Message("TestStruct", [("a", "c"), ("b", "2c")])  # single character  # 2 char string

        test_data = {"a": "a", "b": "no"}

        TestStruct.update(alignment=4)
        packed = TestStruct.pack(test_data)
        assert packed == b"a\x00\x00\x00no\x00\x00"