async def METHOD_NAME(self):
    var = contextvars.ContextVar("var")
    concurrency = 500
    # NOTE: sleep here is not necessary. It's used to simulate IO
    # ensuring that task are not run sequentially
    async def async_inner(val):
        await asyncio.sleep(random.uniform(0.005, 0.015))
        eq_(val, var.get())
        return var.get()
    async def async_set(val):
        await asyncio.sleep(random.uniform(0.005, 0.015))
        var.set(val)
    def inner(val):
        retval = await_only(async_inner(val))
        eq_(val, var.get())
        eq_(retval, val)
        # set the value in a sync function
        newval = val + concurrency
        var.set(newval)
        syncset = await_only(async_inner(newval))
        eq_(newval, var.get())
        eq_(syncset, newval)
        # set the value in an async function
        retval = val + 2 * concurrency
        await_only(async_set(retval))
        eq_(var.get(), retval)
        eq_(await_only(async_inner(retval)), retval)
        return retval
    async def task(val):
        await asyncio.sleep(random.uniform(0.005, 0.015))
        var.set(val)
        await asyncio.sleep(random.uniform(0.005, 0.015))
        return await greenlet_spawn(inner, val)
    values = {
        await coro
        for coro in asyncio.as_completed(
            [task(i) for i in range(concurrency)]
        )
    }
    eq_(values, set(range(concurrency * 2, concurrency * 3)))