Skip to content

Commit

Permalink
add tests for the index param keys
Browse files Browse the repository at this point in the history
  • Loading branch information
shcheklein authored and efiop committed Nov 14, 2023
1 parent a8aec51 commit 86dd078
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/func/test_repo_index.py
Original file line number Diff line number Diff line change
@@ -315,3 +315,26 @@ def test_ignored_dir_unignored_pattern(tmp_dir, dvc, scm):
(stage,) = tmp_dir.dvc_gen({"data/raw/tracked.csv": "5,6,7,8"})
index = Index.from_repo(dvc)
assert index.stages == [stage]


def test_param_keys_returns_default_file(tmp_dir, dvc):
tmp_dir.gen({"params.yaml": "param: 100\n"})
index = Index.from_repo(dvc)
assert index.param_keys == {"repo": {("params.yaml",)}}


def test_param_keys_no_params(dvc):
index = Index.from_repo(dvc)
assert index.param_keys == {"repo": set()}


def test_param_keys_top_level_params(tmp_dir, dvc):
params_file_path = "classifier/custom_params_file.yaml"
top_level_params = f"""
params:
- {params_file_path}
"""
tmp_dir.gen(params_file_path, "param: 100\n")
tmp_dir.gen("dvc.yaml", top_level_params)
index = Index.from_repo(dvc)
assert index.param_keys == {"repo": {("classifier", "custom_params_file.yaml")}}

0 comments on commit 86dd078

Please sign in to comment.