You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
motief/tests/agent_tools/test_database_tools.py

75 lines
2.3 KiB

"""Tests for agent database query primitives."""
import pytest
import json
pytest.importorskip("duckdb")
class TestQueryMotions:
def test_returns_motion_rows(self, tmp_duckdb_path):
from agent_tools.database import query_motions
result = query_motions(tmp_duckdb_path)
assert isinstance(result, list)
def test_respects_limit(self, tmp_duckdb_path):
from agent_tools.database import query_motions
result = query_motions(tmp_duckdb_path, limit=5)
assert len(result) <= 5
def test_empty_db_returns_empty_list(self, tmp_duckdb_path):
from agent_tools.database import query_motions
result = query_motions(tmp_duckdb_path)
assert result == []
class TestQueryVotes:
def test_returns_vote_counts(self, tmp_duckdb_path):
from agent_tools.database import query_votes
result = query_votes(tmp_duckdb_path, motion_id=1)
assert isinstance(result, list)
def test_filters_by_party(self, tmp_duckdb_path):
from agent_tools.database import query_votes
result = query_votes(tmp_duckdb_path, motion_id=1, party="VVD")
assert isinstance(result, list)
class TestQuerySvdVectors:
def test_returns_vectors(self, tmp_duckdb_path):
from agent_tools.database import query_svd_vectors
result = query_svd_vectors(tmp_duckdb_path, window_id="current_parliament")
assert isinstance(result, list)
def test_filters_by_entity_type(self, tmp_duckdb_path):
from agent_tools.database import query_svd_vectors
result = query_svd_vectors(
tmp_duckdb_path, window_id="current_parliament", entity_type="mp"
)
assert isinstance(result, list)
class TestQueryPartyPositions:
def test_returns_party_scores(self, tmp_duckdb_path):
from agent_tools.database import query_party_positions
result = query_party_positions(tmp_duckdb_path, window_id="current_parliament")
assert isinstance(result, list)
class TestQueryPipelineStatus:
def test_returns_status_dict(self, tmp_duckdb_path):
from agent_tools.database import query_pipeline_status
result = query_pipeline_status(tmp_duckdb_path)
assert isinstance(result, dict)
assert "motion_count" in result
assert "latest_motion_date" in result
assert "svd_window_count" in result