def METHOD_NAME(self):
    import pytest
    mod = self.make_module("""
        HPyDef_METH(pack, "pack", HPyFunc_KEYWORDS)
        static HPy pack_impl(HPyContext *ctx, HPy self, const HPy *args,
                             size_t nargs, HPy kwnames)
        {
            HPy out[] = { HPy_NULL, HPy_NULL };
            HPy result;
            if (!HPyHelpers_PackArgsAndKeywords(ctx, args, nargs, kwnames,
                     &out[0], &out[1])) {
                return HPy_NULL;
            }
            for (int i=0; i < 2; i++) {
                if (HPy_IsNull(out[i])) {
                    out[i] = HPy_Dup(ctx, ctx->h_None);
                }
            }
            result = HPyTuple_FromArray(ctx, out, 2);
            for (int i=0; i < 2; i++) {
                HPy_Close(ctx, out[i]);
            }
            return result;
        }
        HPyDef_METH(pack_error, "pack_error", HPyFunc_O)
        static HPy pack_error_impl(HPyContext *ctx, HPy self, HPy arg)
        {
            int success;
            HPy t = HPy_NULL;
            HPy d = HPy_NULL;
            const HPy args[] = { ctx->h_None, ctx->h_True, ctx->h_False };
            size_t nargs = sizeof(args);
            uint64_t mode = HPyLong_AsUInt64_t(ctx, arg);
            switch (mode) {
            case 0:
                success = HPyHelpers_PackArgsAndKeywords(ctx, args, nargs,
                              HPy_NULL, NULL, &d);
                break;
            case 1:
                success = HPyHelpers_PackArgsAndKeywords(ctx, args, nargs,
                              HPy_NULL, &t, NULL);
                break;
            case 2:
                success = HPyHelpers_PackArgsAndKeywords(ctx, args, nargs,
                              HPy_NULL, NULL, NULL);
                break;
            case 3:
                success = HPyHelpers_PackArgsAndKeywords(ctx, args, nargs,
                              ctx->h_None, &t, &d);
                break;
            default:
                success = 0;
                HPyErr_SetString(ctx, ctx->h_ValueError,
                    "unknown test mode");
                break;
            }
            if (success)
                return HPy_Dup(ctx, ctx->h_None);
            return HPy_NULL;
        }
        @EXPORT(pack)
        @EXPORT(pack_error)
        @INIT
    """)
    assert mod.pack() == (None, None)
    assert mod.pack(1, '2', b'3') == ((1, '2', b'3'), None)
    assert mod.pack(1, '2', b'3', a='b', c='d') == ((1, '2', b'3'), dict(a='b', c='d'))
    assert mod.pack(a='b', c='d') == (None, dict(a='b', c='d'))
    for mode in range(3):
        with pytest.raises(SystemError):
            mod.pack_error(mode)
    with pytest.raises(TypeError):
        mod.pack_error(3)