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), ], )
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), ])
def test_compile(self): signature = b"(ss)" off, _ = compile_struct(signature) self.assertEqual(signature, off)