-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import time | ||
from vyper_lsp.debounce import Debouncer # Import Debouncer from your module | ||
|
||
|
||
def test_debounce(): | ||
result = [] | ||
|
||
def test_function(arg): | ||
result.append(arg) | ||
|
||
debouncer = Debouncer(wait=0.5) | ||
debounced_func = debouncer.debounce(test_function) | ||
|
||
debounced_func("first call") | ||
time.sleep(0.2) # Sleep for less than the debounce period | ||
debounced_func("second call") | ||
time.sleep( | ||
0.6 | ||
) # Sleep for more than the debounce period to allow the function to execute | ||
|
||
assert result == ["second call"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters