Coverage for tests/test_docstrings/conftest.py: 100.00%

14 statements  

« prev     ^ index     » next       coverage.py v7.6.2, created at 2024-10-12 01:34 +0200

1"""Pytest fixture for docstrings tests.""" 

2 

3from __future__ import annotations 

4 

5from typing import TYPE_CHECKING 

6 

7import pytest 

8 

9from _griffe.docstrings import google, numpy, sphinx 

10from tests.test_docstrings.helpers import ParserType, parser 

11 

12if TYPE_CHECKING: 

13 from collections.abc import Iterator 

14 

15 

16@pytest.fixture 

17def parse_google() -> Iterator[ParserType]: 

18 """Yield a function to parse Google docstrings. 

19 

20 Yields: 

21 A parser function. 

22 """ 

23 yield from parser(google) 

24 

25 

26@pytest.fixture 

27def parse_numpy() -> Iterator[ParserType]: 

28 """Yield a function to parse Numpy docstrings. 

29 

30 Yields: 

31 A parser function. 

32 """ 

33 yield from parser(numpy) 

34 

35 

36@pytest.fixture 

37def parse_sphinx() -> Iterator[ParserType]: 

38 """Yield a function to parse Sphinx docstrings. 

39 

40 Yields: 

41 A parser function. 

42 """ 

43 yield from parser(sphinx)