File: test_util.py

package info (click to toggle)
python-semantic-release 10.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,236 kB
  • sloc: python: 36,523; sh: 340; makefile: 156
file content (26 lines) | stat: -rw-r--r-- 836 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
import pytest

from semantic_release.commit_parser.util import parse_paragraphs


@pytest.mark.parametrize(
    "text, expected",
    [
        ("", []),
        ("\n\n \n\n \n", []),  # Unix (LF) - empty lines
        ("\r\n\r\n \r\n\r\n \n", []),  # Windows (CRLF) - empty lines
        ("\n\nA\n\nB\n", ["A", "B"]),  # Unix (LF)
        ("\r\n\r\nA\r\n\r\nB\n", ["A", "B"]),  # Windows (CRLF)
        (
            "Long\nexplanation\n\nfull of interesting\ndetails",
            ["Long explanation", "full of interesting details"],
        ),
        (
            # Windows uses CRLF
            "Long\r\nexplanation\r\n\r\nfull of interesting\r\ndetails",
            ["Long explanation", "full of interesting details"],
        ),
    ],
)
def test_parse_paragraphs(text, expected):
    assert parse_paragraphs(text) == expected