コード例 #1
0
ファイル: test_events.py プロジェクト: martinRenou/ipyevents
def test_invalid_slow_method_raises_error():
    # Setting throttle_or_debounce to an invalid name should raise
    # a ValueError.
    event_widget = Event()

    bad_name = 'this is not a valid name'

    with pytest.raises(ValueError) as e:
        event_widget.throttle_or_debounce = bad_name

    assert bad_name in str(e)
    assert 'The event rate limiting method' in str(e)
コード例 #2
0
ファイル: test_events.py プロジェクト: martinRenou/ipyevents
def test_setting_wait_with_debounce_set_preserves_debounce(slow_method):
    # If debounce is set but wait is zero and wait is then set to something
    # non-zero then throttle_or_debounce should still stay debounce.
    event_widget = Event()

    event_widget.throttle_or_debounce = slow_method

    # Make sure wait is currently zero...
    assert event_widget.wait == 0

    # This shouldn't change throttle or debounce
    event_widget.wait = 20

    assert event_widget.throttle_or_debounce == slow_method