Spaces:
Runtime error
Runtime error
File size: 2,177 Bytes
b339b93 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | """Shared pytest fixtures for Paper Trail API tests."""
import pytest
@pytest.fixture
def sample_contribution_row() -> dict:
"""Sample contribution row matching DIME schema."""
return {
"cycle": 2024,
"transaction.id": "TEST123",
"transaction.type": "15",
"amount": 500.00,
"date": "2024-06-15",
"bonica.cid": "CID123",
"contributor.name": "John Doe",
"contributor.type": "I",
"contributor.state": "CA",
"contributor.occupation": "Engineer",
"contributor.employer": "Tech Corp",
"contributor.cfscore": -0.5,
"bonica.rid": "RID456",
"recipient.name": "Jane Smith",
"recipient.party": "100",
"recipient.type": "CAND",
"recipient.state": "CA",
"candidate.cfscore": -0.3,
"seat": "federal:senate",
"election.type": "G",
"occ.standardized": "ENGINEERING",
}
@pytest.fixture
def sample_rows() -> list[dict]:
"""Multiple sample rows for testing filters."""
return [
{
"cycle": 2024,
"amount": 1000.00,
"date": "2024-01-15",
"contributor.state": "CA",
"recipient.state": "CA",
"seat": "federal:senate",
},
{
"cycle": 2022,
"amount": 250.00,
"date": "2022-06-20",
"contributor.state": "NY",
"recipient.state": "NY",
"seat": "federal:house",
},
{
"cycle": 2020,
"amount": 5000.00,
"date": "2020-03-10",
"contributor.state": "TX",
"recipient.state": "TX",
"seat": "state:governor",
},
{
"cycle": 2024,
"amount": 50.00,
"date": "2024-09-01",
"contributor.state": "FL",
"recipient.state": "FL",
"seat": "federal:house",
},
]
@pytest.fixture
def temp_duckdb_path(tmp_path):
"""Temporary DuckDB database path for testing."""
return tmp_path / "test.duckdb"
|