File: test_panels.py

package info (click to toggle)
sphinx-panels 0.6.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 944 kB
  • sloc: python: 1,054; xml: 60; makefile: 23; sh: 16
file content (23 lines) | stat: -rw-r--r-- 761 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import pytest

from sphinx_panels.panels import parse_panels


@pytest.mark.parametrize(
    "content,expected",
    (
        ("a", [{"body": (["a"], 0)}]),
        ("---\na", [{"body": (["a"], 1)}]),
        ("a\n^^^", [{"body": ([], 2), "header": (["a"], 0)}]),
        ("a\n+++", [{"body": (["a"], 0), "footer": ([], 1)}]),
        (
            "a\n^^^\nb\n+++\nc",
            [{"body": (["b"], 2), "footer": (["c"], 3), "header": (["a"], 0)}],
        ),
        ("---\n:card: a", [{"body": ([], 2), "classes": {"card": ["a"]}}]),
        ("a\n---\nb", [{"body": (["a"], 0)}, {"body": (["b"], 2)}]),
    ),
)
def test_parse_panels(content, expected):
    output = parse_panels(content, content_offset=0, default_classes={})
    assert output == expected