File: test_parsed_commit.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 (27 lines) | stat: -rw-r--r-- 794 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
27
from __future__ import annotations

from typing import TYPE_CHECKING

from semantic_release.commit_parser import ParsedCommit
from semantic_release.version.version import LevelBump

if TYPE_CHECKING:
    from tests.conftest import MakeCommitObjFn


def test_parsed_commit_computed_properties(make_commit_obj: MakeCommitObjFn):
    message = "feat(parser): Add new parser pattern"
    commit = make_commit_obj(message)

    parsed_commit = ParsedCommit(
        bump=LevelBump.MINOR,
        type="feature",
        scope="parser",
        descriptions=["Add new parser pattern"],
        breaking_descriptions=[],
        commit=commit,
    )

    assert message == parsed_commit.message
    assert commit.hexsha == parsed_commit.hexsha
    assert commit.hexsha[:7] == parsed_commit.short_hash