mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-09-17 22:29:55 +00:00
implement single-function patches (#69)
This commit is contained in:
@ -5,6 +5,15 @@ from unittest.mock import MagicMock, call
|
||||
from ahriman.models.pkgbuild_patch import PkgbuildPatch
|
||||
|
||||
|
||||
def test_post_init() -> None:
|
||||
"""
|
||||
must remove empty keys
|
||||
"""
|
||||
assert PkgbuildPatch("", "value").key is None
|
||||
assert PkgbuildPatch(None, "value").key is None
|
||||
assert PkgbuildPatch("key", "value").key == "key"
|
||||
|
||||
|
||||
def test_is_function() -> None:
|
||||
"""
|
||||
must correctly define key as function
|
||||
@ -13,6 +22,14 @@ def test_is_function() -> None:
|
||||
assert PkgbuildPatch("key()", "value").is_function
|
||||
|
||||
|
||||
def test_is_plain_diff() -> None:
|
||||
"""
|
||||
must correctly define key as function
|
||||
"""
|
||||
assert not PkgbuildPatch("key", "value").is_plain_diff
|
||||
assert PkgbuildPatch(None, "value").is_plain_diff
|
||||
|
||||
|
||||
def test_quote() -> None:
|
||||
"""
|
||||
must quote strings if unsafe flag is not set
|
||||
@ -32,6 +49,13 @@ def test_serialize() -> None:
|
||||
assert PkgbuildPatch("key", "4'2", unsafe=True).serialize() == "key=4'2"
|
||||
|
||||
|
||||
def test_serialize_plain_diff() -> None:
|
||||
"""
|
||||
must correctly serialize function values
|
||||
"""
|
||||
assert PkgbuildPatch(None, "{ value }").serialize() == "{ value }"
|
||||
|
||||
|
||||
def test_serialize_function() -> None:
|
||||
"""
|
||||
must correctly serialize function values
|
||||
|
Reference in New Issue
Block a user