1
0
Fork 0

Adding upstream version 4.6.0+dfsg.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-04-21 10:42:01 +02:00
parent f3ad83a1a5
commit 167a3f8553
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
275 changed files with 30423 additions and 0 deletions

26
tests/test_cz_utils.py Normal file
View file

@ -0,0 +1,26 @@
import pytest
from pytest_mock import MockFixture
from commitizen.cz import exceptions, utils
def test_required_validator():
assert utils.required_validator("test") == "test"
with pytest.raises(exceptions.AnswerRequiredError):
utils.required_validator("")
def test_multiple_line_breaker():
message = "this is the first line | and this is the second line "
result = utils.multiple_line_breaker(message)
assert result == "this is the first line\nand this is the second line"
result = utils.multiple_line_breaker(message, "is")
assert result == "th\n\nthe first line | and th\n\nthe second line"
def test_get_backup_file_path_no_project_root(mocker: MockFixture):
project_root_mock = mocker.patch("commitizen.git.find_git_project_root")
project_root_mock.return_value = None
assert utils.get_backup_file_path()