doctest_usecase.py 484 Bytes
Newer Older
dugupeiwen's avatar
dugupeiwen committed
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
"""
Test that all docstrings are the same:

>>> len({f.__doc__ for f in (a, b, c, d)})
1
"""
from numba import guvectorize, int64, njit, vectorize


def a():
    """>>> x = 1"""
    return 1


@njit
def b():
    """>>> x = 1"""
    return 1


@guvectorize([(int64[:], int64, int64[:])], "(n),()->(n)")
def c(x, y, res):
    """>>> x = 1"""
    for i in range(x.shape[0]):
        res[i] = x[i] + y


@vectorize([int64(int64, int64)])
def d(x, y):
    """>>> x = 1"""
    return x + y