Skip to content

Commit 5e099ac

Browse files
committed
Comments and add test of interval getter
1 parent 33ba756 commit 5e099ac

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def test_interval_is_the_same():
5757

5858

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

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

7274
assertEqual(db.value, False)
7375
assertEqual(db.rose, False)
7476
assertEqual(db.fell, False)
7577

78+
# and then once the whole time has passed make sure it did change
7679
time.sleep(0.11)
7780
db.update()
7881
assertEqual(db.value, True)

0 commit comments

Comments
 (0)