MCPcopy Index your code
hub / github.com/reactive-python/reactpy / test_option_validator

Function test_option_validator

src/py/reactpy/tests/test__option.py:28–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26
27@mock.patch.dict(os.environ, {"A_FAKE_OPTION": "1"})
28def test_option_validator():
29 opt = Option("A_FAKE_OPTION", False, validator=lambda x: bool(int(x)))
30
31 assert opt.current is True
32
33 opt.current = "0"
34 assert opt.current is False
35
36 with pytest.raises(ValueError, match="Invalid value"):
37 opt.current = "not-an-int"
38
39
40def test_immutable_option():

Callers

nothing calls this directly

Calls 1

OptionClass · 0.90

Tested by

no test coverage detected