Exemplo n.º 1
0
    def test_apply(self):
        signature = b"(ss)"
        call_arg = (b"arg_1", b"arg_2")

        _, func = compile_struct(signature)

        self.assertEqual(
            func(call_arg),
            [
                (ord(b"r"), signature[1:-1]),
                (ord(b"s"), b"arg_1"),
                (ord(b"s"), b"arg_2"),
                (-1, None),
            ],
        )
Exemplo n.º 2
0
    def test_apply(self):
        signature = b'(ss)'
        call_arg = (
            b"arg_1",
            b"arg_2",
        )

        _, func = compile_struct(signature)

        self.assertEqual(func(call_arg), [
            (ord(b'r'), signature[1:-1]),
            (ord(b's'), b"arg_1"),
            (ord(b's'), b"arg_2"),
            (-1, None),
        ])
Exemplo n.º 3
0
 def test_compile(self):
     signature = b"(ss)"
     off, _ = compile_struct(signature)
     self.assertEqual(signature, off)