feat: filter option parsing with tests

This commit is contained in:
Oliver Hofmann
2026-06-02 20:57:33 +02:00
parent db60fdd635
commit 54ee01c475
3 changed files with 42 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
import importlib.util, pathlib, sys
from importlib.machinery import SourceFileLoader
_path = pathlib.Path(__file__).parent.parent / "filter" / "kyofilter"
_spec = importlib.util.spec_from_loader("kyofilter", SourceFileLoader("kyofilter", str(_path)))
_mod = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_mod)
sys.modules["kyofilter"] = _mod
+16
View File
@@ -0,0 +1,16 @@
import kyofilter
class TestParseOptions:
def test_single_key_value(self):
assert kyofilter.parse_options("KmManagment=MG12345") == {"KmManagment": "MG12345"}
def test_multiple_options(self):
result = kyofilter.parse_options("KmManagment=MG12345 Duplex=DuplexNoTumble")
assert result == {"KmManagment": "MG12345", "Duplex": "DuplexNoTumble"}
def test_empty_string(self):
assert kyofilter.parse_options("") == {}
def test_flag_without_value(self):
assert kyofilter.parse_options("SomeFlag") == {"SomeFlag": "true"}