File: test_txt.py

package info (click to toggle)
python-readme-renderer 44.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 728 kB
  • sloc: python: 414; sh: 23; makefile: 6
file content (26 lines) | stat: -rw-r--r-- 628 bytes parent folder | download | duplicates (2)
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
from pathlib import Path

import pytest

from readme_renderer.txt import render


@pytest.mark.parametrize(
    ("txt_filename", "html_filename"),
    [
        (pytest.param(fn, fn.with_suffix(".html"), id=fn.name))
        for fn in Path(__file__).parent.glob("fixtures/test_*.txt")
    ],
)
def test_txt_fixtures(txt_filename, html_filename):
    # Get our Markup
    with open(txt_filename, encoding='utf-8') as f:
        txt_markup = f.read()

    # Get our expected
    with open(html_filename, encoding="utf-8") as f:
        expected = f.read()

    out = render(txt_markup)

    assert out.strip() == expected.strip()