chore: apply linting fixes and expand ruff coverage to test suite
This commit is contained in:
@@ -1,30 +1,31 @@
|
||||
from pygui.backend.models.frame import Frame
|
||||
from pygui.backend.models.frame_player import FramePlayer
|
||||
|
||||
|
||||
def frames(n):
|
||||
return [Frame(seq=i, time=float(i), values=[149.0 + i])for i in range(n)]
|
||||
|
||||
def test_loads_and_reports_total():
|
||||
p = FramePlayer(); p.load(frames(3))
|
||||
assert p.total == 3 and p.index == 0
|
||||
assert p.total == 3 and p.index == 0
|
||||
current = p.current()
|
||||
assert current is not None
|
||||
assert current.values == [149.0]
|
||||
|
||||
|
||||
def test_step_forward_and_back_clamps():
|
||||
p = FramePlayer(); p.load(frames(3))
|
||||
assert p.step(1).index == 1
|
||||
assert p.step(1).index == 2
|
||||
assert p.step(1).index == 2
|
||||
assert p.step(-5).index == 0
|
||||
|
||||
|
||||
def test_seek():
|
||||
p = FramePlayer(); p.load(frames(5))
|
||||
assert p.seek(3).index == 3
|
||||
assert p.seek(99).index == 4
|
||||
|
||||
|
||||
def test_at_end():
|
||||
p = FramePlayer(); p.load(frames(2))
|
||||
assert not p.at_end
|
||||
p.seek(1)
|
||||
assert p.at_end
|
||||
assert p.at_end
|
||||
|
||||
Reference in New Issue
Block a user