37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
"""Tests for Balabit Mouse Dynamics Challenge data adapter."""
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
|
|
def test_module_exports():
|
|
"""The adapter module must export the public functions used by CLI."""
|
|
from ai_mouse.data_adapters import balabit
|
|
assert hasattr(balabit, "parse_session_csv")
|
|
assert hasattr(balabit, "segment_by_clicks")
|
|
assert hasattr(balabit, "filter_segments")
|
|
assert hasattr(balabit, "process_session")
|
|
assert hasattr(balabit, "MouseEvent")
|
|
assert hasattr(balabit, "Segment")
|
|
|
|
|
|
def test_mouse_event_dataclass():
|
|
"""MouseEvent has expected fields."""
|
|
from ai_mouse.data_adapters.balabit import MouseEvent
|
|
e = MouseEvent(t_ms=100, button="NoButton", state="Move", x=300, y=400)
|
|
assert e.t_ms == 100
|
|
assert e.state == "Move"
|
|
assert e.x == 300
|
|
|
|
|
|
def test_segment_dataclass():
|
|
"""Segment has expected fields."""
|
|
from ai_mouse.data_adapters.balabit import MouseEvent, Segment
|
|
events = [MouseEvent(t_ms=0, button="NoButton", state="Move", x=10, y=20)]
|
|
s = Segment(events=events, click_x=100, click_y=200, click_t_ms=500, session_id="user1_s1")
|
|
assert s.events == events
|
|
assert s.click_x == 100
|
|
assert s.session_id == "user1_s1"
|