Coverage for tests/test_themes.py: 100.00%

10 statements  

« prev     ^ index     » next       coverage.py v7.6.0, created at 2024-08-01 19:41 +0200

1"""Tests for the different themes we claim to support.""" 

2 

3from __future__ import annotations 

4 

5from typing import TYPE_CHECKING 

6 

7import pytest 

8 

9if TYPE_CHECKING: 

10 from markdown import Markdown 

11 from mkdocstrings.plugin import MkdocstringsPlugin 

12 

13 

14@pytest.mark.parametrize( 

15 "plugin", 

16 [ 

17 {"theme": "mkdocs"}, 

18 {"theme": "readthedocs"}, 

19 {"theme": {"name": "material"}}, 

20 ], 

21 indirect=["plugin"], 

22) 

23@pytest.mark.parametrize( 

24 "identifier", 

25 [ 

26 "docs/snippets/hello.h" 

27 ], 

28) 

29def test_render_themes_templates_python(identifier: str, plugin: MkdocstringsPlugin, ext_markdown: Markdown) -> None: 

30 """Test rendering of a given theme's templates. 

31 

32 Parameters: 

33 identifier: Parametrized identifier. 

34 plugin: Pytest fixture (see conftest.py). 

35 ext_markdown: Pytest fixture (see conftest.py). 

36 """ 

37 handler = plugin.handlers.get_handler("c") 

38 handler._update_env(ext_markdown, plugin.handlers._config) 

39 data = handler.collect(identifier, {}) 

40 handler.render(data, {})