Example #1
0
def test_setting_lock():
    """Test a setting lock."""
    lock = _Setting("TESTLOCK", False)
    setting = _Setting("TESTSETTING", False, lock=lock)
    setting.on()
    assert setting
    lock.on()
    with pytest.raises(RuntimeError):
        setting.off()
    assert setting
    lock.off()
    setting.off()
    assert not setting
Example #2
0
def test_setting_inverse():
    """Make a setting and test inverse setting."""
    setting = _Setting("TESTSETTING", False)
    inv = setting.inverse
    assert not setting
    assert inv
    
    inv.off()
    assert setting
    assert not inv