File: _test_py35.py

package info (click to toggle)
python-makefun 1.15.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 440 kB
  • sloc: python: 2,384; makefile: 2
file content (42 lines) | stat: -rw-r--r-- 811 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from asyncio import sleep


def make_native_coroutine_handler():
    """Returns a native coroutine to be used in tests"""

    async def my_native_coroutine_handler(sleep_time):
        await sleep(sleep_time)
        return sleep_time

    return my_native_coroutine_handler


def make_ref_function():
    """Returns a function with a type hint that is locally defined """

    # the symbol is defined here, so it is not seen outside
    class A:
        pass

    def ref(a: A) -> A:
        pass

    return ref


def make_ref_function2():
    """ """
    from typing import Any

    def ref(a: Any):
        pass

    return ref


def get_my_wrapper(f):
    def my_wrapper(*args, a, **kwargs):
        # a is automatically extracted from the sig
        return a + f(*args, **kwargs)

    return my_wrapper