mirror of
https://github.com/microsoft/graphrag.git
synced 2025-08-15 12:11:44 +00:00

* Consistent config load_config - Provide a consistent way to load configuration - Resolve potential timestamp directories upfront upon config object creation - Add unit tests for resolving timestamp directories - Resolves #599 - Resolves #1049 * fix formatting issues * remove unnecessary path resolution * fix smoke tests * update prompts to use load_config * Update none checks * Update none checks * Update searching for config method signature * Update unit tests * fix formatting issues
34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
# Copyright (c) 2024 Microsoft Corporation.
|
|
# Licensed under the MIT License
|
|
|
|
from pathlib import Path
|
|
|
|
from graphrag.config.resolve_timestamp_path import resolve_timestamp_path
|
|
|
|
|
|
def test_resolve_timestamp_path_no_timestamp_with_run_id():
|
|
path = Path("path/to/data")
|
|
result = resolve_timestamp_path(path, "20240812-121000")
|
|
assert result == path
|
|
|
|
|
|
def test_resolve_timestamp_path_no_timestamp_without_run_id():
|
|
path = Path("path/to/data")
|
|
result = resolve_timestamp_path(path)
|
|
assert result == path
|
|
|
|
|
|
def test_resolve_timestamp_path_with_timestamp_and_run_id():
|
|
path = Path("some/path/${timestamp}/data")
|
|
expected = Path("some/path/20240812/data")
|
|
result = resolve_timestamp_path(path, "20240812")
|
|
assert result == expected
|
|
|
|
|
|
def test_resolve_timestamp_path_with_timestamp_and_inferred_directory():
|
|
cwd = Path(__file__).parent
|
|
path = cwd / "fixtures/timestamp_dirs/${timestamp}/data"
|
|
expected = cwd / "fixtures/timestamp_dirs/20240812-120000/data"
|
|
result = resolve_timestamp_path(path)
|
|
assert result == expected
|