diff --git a/src/simple_config_parser/simple_config_parser.py b/src/simple_config_parser/simple_config_parser.py index 409161c..a4b2128 100644 --- a/src/simple_config_parser/simple_config_parser.py +++ b/src/simple_config_parser/simple_config_parser.py @@ -85,7 +85,7 @@ class DuplicateOptionError(Exception): class SimpleConfigParser: """A customized config parser targeted at handling Klipper style config files""" - _SECTION_RE = re.compile(r"\s*\[(\w+ ?\w+)]\s*([#;].*)?$") + _SECTION_RE = re.compile(r"\s*\[(\w+\s?[\w\-]+)]\s*([#;].*)?$") _OPTION_RE = re.compile(r"^\s*(\w+)\s*[:=]\s*([^=:].*)\s*([#;].*)?$") _MLOPTION_RE = re.compile(r"^\s*(\w+)\s*[:=]\s*([#;].*)?$") _COMMENT_RE = re.compile(r"^\s*([#;].*)?$") diff --git a/tests/features/line_type_detection/data/case_line_is_section.py b/tests/features/line_type_detection/data/case_line_is_section.py index 663eabe..d2ef185 100644 --- a/tests/features/line_type_detection/data/case_line_is_section.py +++ b/tests/features/line_type_detection/data/case_line_is_section.py @@ -1,5 +1,6 @@ testcases = [ ("[example_section]", True), + ("[update_manager moonraker-obico]", True), ("[example_section two]", True), ("not_a_valid_section", False), ("section: invalid", False), diff --git a/tests/features/public_api/test_public_api.py b/tests/features/public_api/test_public_api.py index 10d86b1..0e59b5a 100644 --- a/tests/features/public_api/test_public_api.py +++ b/tests/features/public_api/test_public_api.py @@ -108,7 +108,7 @@ class TestPublicAPI: assert parser._config[section]["body"][0]["option"] == option values = ["value1", "value2", "value3"] - raw_values = [" value1\n", " value2\n", " value3\n"] + raw_values = [" value1\n", " value2\n", " value3\n"] assert parser._config[section]["body"][0]["value"] == values assert parser._config[section]["body"][0]["_raw"] == f"{option}:\n" assert parser._config[section]["body"][0]["_raw_value"] == raw_values