diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-17 09:33:16 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-17 09:33:16 +0200 |
| commit | 73840b30b9943e9b7de03e6172dbe7a51582ff94 (patch) | |
| tree | 50f76381d696b26f9c707f925af2c79b73e003b7 /tests | |
| parent | 14c2236a733a65a58bf2cc8ccb6406718635cf49 (diff) | |
| download | hyprsunset-qt-73840b30b9943e9b7de03e6172dbe7a51582ff94.tar.gz hyprsunset-qt-73840b30b9943e9b7de03e6172dbe7a51582ff94.zip | |
feat: parse hyprsunset.conf profiles
Implement minimal config parser with Profile dataclass and parse_config function.
Regex-based parsing of hyprsunset.conf format with support for time, identity,
temperature, and gamma fields. Foundation for later tasks (serialize, read/write, validation).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_config.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_config.py b/tests/test_config.py new file mode 100644 index 0000000..4568160 --- /dev/null +++ b/tests/test_config.py @@ -0,0 +1,25 @@ +from hyprsunset_qt.config import Profile, parse_config + + +def test_parse_two_profiles(): + text = """ +profile { + time = 5:00 + identity = true +} + +profile { + time = 19:40 + temperature = 5500 + gamma = 0.8 +} +""" + profiles = parse_config(text) + assert profiles == [ + Profile(time="5:00", identity=True, temperature=None, gamma=None), + Profile(time="19:40", identity=False, temperature=5500, gamma=0.8), + ] + + +def test_parse_empty(): + assert parse_config("") == [] |
