mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[copybara] Sync with robotpy (#8964)
GitOrigin-RevId: 9dff8f977401e78be0bb6f39cea2328320ab2d95
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
|
||||
import wpiutil
|
||||
import time
|
||||
import pytest
|
||||
|
||||
|
||||
def test_default():
|
||||
wpi_now = wpiutil.now() * 1e-6
|
||||
py_now = int(time.time())
|
||||
@@ -14,6 +14,7 @@ def test_default():
|
||||
|
||||
NOW_TIMESTAMP_S = 0
|
||||
|
||||
|
||||
def custom_now_getter():
|
||||
global NOW_TIMESTAMP_S
|
||||
return int(NOW_TIMESTAMP_S * 1e6)
|
||||
@@ -33,7 +34,7 @@ def test_custom_timestamp(custom_fixture):
|
||||
|
||||
NOW_TIMESTAMP_S = 1.5
|
||||
assert 1_500_000 == wpiutil.now()
|
||||
|
||||
|
||||
NOW_TIMESTAMP_S = 100
|
||||
assert 100_000_000 == wpiutil.now()
|
||||
|
||||
@@ -42,5 +43,3 @@ def test_custom_timestamp(custom_fixture):
|
||||
wpi_now = wpiutil.now() * 1e-6
|
||||
py_now = int(time.time())
|
||||
assert py_now == pytest.approx(wpi_now, abs=1)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user