File: test_builder.py

package info (click to toggle)
python-hatch-fancy-pypi-readme 25.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 296 kB
  • sloc: python: 906; makefile: 3
file content (38 lines) | stat: -rw-r--r-- 1,073 bytes parent folder | download
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
27
28
29
30
31
32
33
34
35
36
37
38
# SPDX-FileCopyrightText: 2022 Hynek Schlawack <hs@ox.cx>
#
# SPDX-License-Identifier: MIT

from hatch_fancy_pypi_readme._builder import build_text
from hatch_fancy_pypi_readme._fragments import TextFragment


class TestBuildText:
    def test_single_text_fragment(self):
        """
        A single text fragment becomes the readme.
        """
        assert "This is the README for your-package 1.0!" == build_text(
            [
                TextFragment(
                    "This is the README for $HFPR_PACKAGE_NAME $HFPR_VERSION!"
                )
            ],
            [],
            "your-package",
            "1.0",
        )

    def test_multiple_text_fragment(self):
        """
        A multiple text fragment are concatenated without adding any
        characters.
        """
        assert "# Level 1\n\nThis is the README!" == build_text(
            [
                TextFragment("# Level 1\n\n"),
                TextFragment("This is the README!"),
            ],
            [],
            "your-package",
            "1.0",
        )