()
| 83 | |
| 84 | |
| 85 | def test_option_subscribe(): |
| 86 | opt = Option("A_FAKE_OPTION", "default") |
| 87 | |
| 88 | calls = [] |
| 89 | opt.subscribe(calls.append) |
| 90 | assert calls == ["default"] |
| 91 | |
| 92 | opt.current = "default" |
| 93 | # value did not change, so no trigger |
| 94 | assert calls == ["default"] |
| 95 | |
| 96 | opt.current = "new-1" |
| 97 | opt.current = "new-2" |
| 98 | assert calls == ["default", "new-1", "new-2"] |
| 99 | |
| 100 | opt.unset() |
| 101 | assert calls == ["default", "new-1", "new-2", "default"] |
| 102 | |
| 103 | |
| 104 | def test_deprecated_option(): |