# Path: pq/api.py



import os
import sys
import asyncio
import threading
from pulsar.api import send, create_future
from pulsar.apps import rpc
from pq import api
        tasks = self.api.tasks
        task = await tasks.queue('asynchronous', callback=False)
        self.assertTrue(task.id)
        self.assertEqual(task.status_string, 'QUEUED')
        self.assertTrue('ID=%s' % task.id in repr(task.done_callback))
        task = await task.done_callback
        self.assertEqual(task.status_string, 'SUCCESS')

    async def test_cpubound_task(self):
        tasks = self.api.tasks
        task = await tasks.queue('cpubound')
        self.assertIsInstance(task, api.Task)
        self.assertEqual(task.status_string, 'SUCCESS')
        self.assertEqual(task.result, ['OK', 2])

    async def __test_error_cpubound_task(self):
        tasks = self.api.tasks
        task = await tasks.queue('cpubound', error=True)
        self.assertIsInstance(task, api.Task)
        self.assertEqual(task.status_string, 'FAILURE')
        self.assertTrue(task.stacktrace)

    async def test_is_in_greenlet(self):
        tasks = self.api.tasks
        task = await tasks.queue('cpuboundwithasync')
        self.assertIsInstance(task, api.Task)
        self.assertEqual(task.status_string, 'SUCCESS')
        self.assertEqual(task.result, True)

    async def test_cpu_supports_asyncio(self):

# Path: pq/api.py



# Path: tests/app.py
import os
import sys
import asyncio
import threading
from pulsar.api import send, create_future
from pulsar.apps import rpc
from pq import api

        tasks = self.api.tasks
        task = await tasks.queue('asynchronous', callback=False)
        self.assertTrue(task.id)
        self.assertEqual(task.status_string, 'QUEUED')
        self.assertTrue('ID=%s' % task.id in repr(task.done_callback))
        task = await task.done_callback
        self.assertEqual(task.status_string, 'SUCCESS')

    async def test_cpubound_task(self):
        tasks = self.api.tasks
        task = await tasks.queue('cpubound')
        self.assertIsInstance(task, api.Task)
        self.assertEqual(task.status_string, 'SUCCESS')
        self.assertEqual(task.result, ['OK', 2])

    async def __test_error_cpubound_task(self):
        tasks = self.api.tasks
        task = await tasks.queue('cpubound', error=True)
        self.assertIsInstance(task, api.Task)
        self.assertEqual(task.status_string, 'FAILURE')
        self.assertTrue(task.stacktrace)

    async def test_is_in_greenlet(self):
        tasks = self.api.tasks
        task = await tasks.queue('cpuboundwithasync')
        self.assertIsInstance(task, api.Task)
        self.assertEqual(task.status_string, 'SUCCESS')
        self.assertEqual(task.result, True)

    async def test_cpu_supports_asyncio(self):

        tasks = self.api.tasks