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

14 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-08-15 16:47 +0200

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

2 

3from __future__ import annotations 

4 

5from typing import Iterator 

6 

7import pytest 

8 

9from _griffe.docstrings import google, numpy, sphinx 

10from tests.test_docstrings.helpers import ParserType, parser 

11 

12 

13@pytest.fixture 

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

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

16 

17 Yields: 

18 A parser function. 

19 """ 

20 yield from parser(google) 

21 

22 

23@pytest.fixture 

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

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

26 

27 Yields: 

28 A parser function. 

29 """ 

30 yield from parser(numpy) 

31 

32 

33@pytest.fixture 

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

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

36 

37 Yields: 

38 A parser function. 

39 """ 

40 yield from parser(sphinx)