Skip to content

Hypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.

test: ConfigManager saves to a custom nested path

dex0shubham40b825b9ee05
diff --git a/tests/cli/test_config.py b/tests/cli/test_config.py
new file mode 100644
index 0000000..8af1eef
--- /dev/null
+++ b/tests/cli/test_config.py
@@ -0,0 +1,17 @@
+"""Tests for ConfigManager persistence."""
+
+from hyperextract.cli.config import ConfigManager
+
+
+def test_save_creates_custom_parent_dir(tmp_path):
+ """_save() must create the parent of a custom config_path, not the default dir."""
+ cfg_path = tmp_path / "nested" / "dir" / "config.toml" # parent doesn't exist yet
+
+ mgr = ConfigManager(cfg_path)
+ mgr.set_llm(provider="openai", model="gpt-4o-mini", api_key="sk-x")
+
+ assert cfg_path.exists()
+
+ # Round-trips back through a fresh manager.
+ reloaded = ConfigManager(cfg_path)
+ assert reloaded.llm.model == "gpt-4o-mini"