Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to time.monotonic_ns() when it's available #10

Open
wants to merge 6 commits into
base: master
from
Open
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Prev

Comments and add test of interval getter

  • Loading branch information
tgs committed Aug 13, 2019
commit 5e099acd2f3b356b83dd611a86eaf2f28f7bc308
@@ -57,6 +57,7 @@ def test_interval_is_the_same():


def test_setting_interval():
# Check that setting the interval does change the time the debouncer waits
db = adafruit_debouncer.Debouncer(_false, interval=0.01)
db.update()

@@ -66,13 +67,15 @@ def test_setting_interval():
db.function = _true
db.interval = 0.2
db.update()
assert db.interval - 0.2 < 0.00001, "interval is not consistent"
time.sleep(0.11)
db.update()

assertEqual(db.value, False)
assertEqual(db.rose, False)
assertEqual(db.fell, False)

# and then once the whole time has passed make sure it did change
time.sleep(0.11)
db.update()
assertEqual(db.value, True)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.