Ejemplo n.º 1
0
    def recognizes_an_old_style_coroutine():
        @asyncio.coroutine
        def some_old_style_coroutine():
            yield False  # pragma: no cover

        assert is_awaitable(some_old_style_coroutine())
        assert is_awaitable(some_old_style_coroutine())
Ejemplo n.º 2
0
    async def recognizes_a_future_object():
        async def some_coroutine():
            return False  # pragma: no cover

        some_future = asyncio.ensure_future(some_coroutine())

        assert is_awaitable(some_future)
        assert is_awaitable(some_future)
Ejemplo n.º 3
0
 async def await_execution_results():
     execution_results, all_params = self.run_http_query(
         request_method, data, catch)
     return [
         ex if ex is None or not is_awaitable(ex) else await ex
         for ex in execution_results
     ], all_params
Ejemplo n.º 4
0
 async def _complete(list_field):
     result = execute(
         build_schema("type Query { listField: [String] }"),
         parse("{ listField }"),
         Data(list_field),
     )
     assert is_awaitable(result)
     result = cast(Awaitable, result)
     return await result
Ejemplo n.º 5
0
    def declines_an_async_generator():
        async def some_async_generator():
            yield True  # pragma: no cover

        assert not isawaitable(some_async_generator())
        assert not is_awaitable(some_async_generator())
Ejemplo n.º 6
0
 def declines_the_none_value():
     assert not isawaitable(None)
     assert not is_awaitable(None)
Ejemplo n.º 7
0
    async def recognizes_a_coroutine_object():
        async def some_coroutine():
            return False  # pragma: no cover

        assert isawaitable(some_coroutine())
        assert is_awaitable(some_coroutine())
Ejemplo n.º 8
0
    def declines_a_coroutine_function():
        async def some_coroutine():
            return True  # pragma: no cover

        assert not isawaitable(some_coroutine)
        assert not is_awaitable(some_coroutine)
Ejemplo n.º 9
0
 def declines_an_int_value():
     assert not is_awaitable(42)
Ejemplo n.º 10
0
    def declines_a_normal_function():
        def some_function():
            return True

        assert not isawaitable(some_function())
        assert not is_awaitable(some_function)
Ejemplo n.º 11
0
 def declines_a_lambda_function():
     assert not isawaitable(lambda: True)  # pragma: no cover
     assert not is_awaitable(lambda: True)  # pragma: no cover
Ejemplo n.º 12
0
 def declines_the_type_class():
     assert not isawaitable(type)
     assert not is_awaitable(type)
Ejemplo n.º 13
0
 def declines_an_object_instance():
     assert not isawaitable(object())
     assert not is_awaitable(object())
Ejemplo n.º 14
0
 def declines_a_dict_value():
     assert not isawaitable({})
     assert not is_awaitable({})
Ejemplo n.º 15
0
 def declines_a_string_value():
     assert not isawaitable("some_string")
     assert not is_awaitable("some_string")
Ejemplo n.º 16
0
    def declines_a_normal_generator_object():
        def some_generator():
            yield True  # pragma: no cover

        assert not isawaitable(some_generator())
        assert not is_awaitable(some_generator())
Ejemplo n.º 17
0
 def declines_a_boolean_value():
     assert not isawaitable(True)
     assert not is_awaitable(True)