File: conftest.py

package info (click to toggle)
python-griffe 1.15.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,292 kB
  • sloc: python: 17,202; makefile: 47; sh: 24; javascript: 13
file content (43 lines) | stat: -rw-r--r-- 885 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
43
"""Pytest fixture for docstrings tests."""

from __future__ import annotations

from typing import TYPE_CHECKING

import pytest

from griffe._internal.docstrings import google, numpy, sphinx
from tests.test_docstrings.helpers import ParserType, parser

if TYPE_CHECKING:
    from collections.abc import Iterator


@pytest.fixture
def parse_google() -> Iterator[ParserType]:
    """Yield a function to parse Google docstrings.

    Yields:
        A parser function.
    """
    yield from parser(google)


@pytest.fixture
def parse_numpy() -> Iterator[ParserType]:
    """Yield a function to parse Numpy docstrings.

    Yields:
        A parser function.
    """
    yield from parser(numpy)


@pytest.fixture
def parse_sphinx() -> Iterator[ParserType]:
    """Yield a function to parse Sphinx docstrings.

    Yields:
        A parser function.
    """
    yield from parser(sphinx)