Skip to content

Commit

Permalink
Use OmegaConf.set_readonly() in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
odelalleau committed Apr 16, 2021
1 parent c372a58 commit ac26495
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/interpolation/built_in_resolvers/test_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def test_dict_values_are_typed() -> None:
)
def test_readonly_parent(cfg: Any, expected: Any) -> None:
cfg = OmegaConf.create(cfg)
cfg._set_flag("readonly", True)
OmegaConf.set_readonly(cfg, True)
assert cfg.x == expected


Expand Down
4 changes: 2 additions & 2 deletions tests/interpolation/test_custom_resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def test_resolver_output_dict(restore_resolvers: Any, readonly: bool) -> None:
some_dict = {"a": 0, "b": "${y}"}
OmegaConf.register_new_resolver("dict", lambda: some_dict)
c = OmegaConf.create({"x": "${dict:}", "y": -1})
c._set_flag("readonly", readonly)
OmegaConf.set_readonly(c, readonly)
assert c.x == some_dict
x_node = dereference_node(c, "x")
assert isinstance(x_node, AnyNode)
Expand All @@ -363,7 +363,7 @@ def test_resolver_output_list(restore_resolvers: Any, readonly: bool) -> None:
some_list = ["a", 0, "${y}"]
OmegaConf.register_new_resolver("list", lambda: some_list)
c = OmegaConf.create({"x": "${list:}", "y": -1})
c._set_flag("readonly", readonly)
OmegaConf.set_readonly(c, readonly)
assert c.x == some_list
x_node = dereference_node(c, "x")
assert isinstance(x_node, AnyNode)
Expand Down

0 comments on commit ac26495

Please sign in to comment.