feat: filter option parsing with tests
This commit is contained in:
@@ -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
|
||||
@@ -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"}
|
||||
Reference in New Issue
Block a user