Skip to content

Commit

Permalink
Combine two tests together
Browse files Browse the repository at this point in the history
  • Loading branch information
odelalleau committed Feb 24, 2021
1 parent b9a5db6 commit 585183c
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions tests/test_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ def test_select_default(
@pytest.mark.parametrize(
"cfg, key",
[
pytest.param({"missing": "???"}, "missing", id="missing"),
pytest.param({"missing": "???"}, "missing", id="missing_dict"),
pytest.param(["???"], "0", id="missing_list"),
],
)
def test_select_default_throw_on_missing_dict(
def test_select_default_throw_on_missing(
cfg: Any,
struct: bool,
key: Any,
Expand All @@ -100,23 +101,6 @@ def test_select_default_throw_on_missing_dict(
OmegaConf.select(cfg, key, default=default, throw_on_missing=True)


@pytest.mark.parametrize(
"cfg, key",
[
pytest.param(["???"], "0", id="missing"),
],
)
def test_select_default_throw_on_missing_list(
cfg: Any,
key: Any,
) -> None:
cfg = OmegaConf.create(cfg)

# throw on missing still throws if default is provided
with pytest.raises(MissingMandatoryValue):
OmegaConf.select(cfg, key, default=0, throw_on_missing=True)


@pytest.mark.parametrize(
("cfg", "node_key", "expected"),
[
Expand Down

0 comments on commit 585183c

Please # to comment.