From 820f7fa8d261b5ea0e7ebfb0c42e2b9109d98a11 Mon Sep 17 00:00:00 2001 From: Jesse Mortenson Date: Fri, 10 Jan 2025 16:51:35 -0600 Subject: [PATCH] Fix linting --- api/schemas.py | 4 +++- api/tests/test_bills.py | 16 ++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/api/schemas.py b/api/schemas.py index 602772d..da19841 100644 --- a/api/schemas.py +++ b/api/schemas.py @@ -253,10 +253,11 @@ class BillSponsorship(BaseModel): person: Optional[CompactPerson] primary: bool classification: str = Field(..., example="primary") - + class Config: orm_mode = True + class BillActionRelatedEntity(BaseModel): name: str = Field(..., example="Senate Committee of the Whole") entity_type: str = Field(..., example="organization") @@ -316,6 +317,7 @@ class PersonVote(BaseModel): class Config: orm_mode = True + class VoteEvent(BaseModel): id: str motion_text: str = Field(..., example="Shall the bill be passed?") diff --git a/api/tests/test_bills.py b/api/tests/test_bills.py index 6e05ca5..f82f78f 100644 --- a/api/tests/test_bills.py +++ b/api/tests/test_bills.py @@ -203,7 +203,7 @@ def test_bills_include_documents_versions(client): assert len(b["documents"]) == 3 assert len(b["versions"]) == 2 version = b["versions"][0] - version_id = version.pop("id") # they are dynamic uuids so... + version_id = version.pop("id") # they are dynamic uuids so... assert uuid.UUID(version_id) assert isinstance(version_id, str) assert version == { @@ -229,11 +229,10 @@ def test_bills_include_votes(client): votes = b["votes"] for vote in votes: for person_vote in vote["votes"]: - vote_people_id = person_vote.pop("id") + vote_people_id = person_vote.pop("id") assert uuid.UUID(vote_people_id) assert isinstance(vote_people_id, str) - assert b["votes"] == [ { "id": "ocd-vote/1", @@ -411,23 +410,24 @@ def test_bill_detail_sponsorship_resolution(client): } assert query_logger.count == 3 + def test_bills_include_actions(client): response = client.get("/bills?jurisdiction=ne&session=2020&include=actions") - + for bill in response.json()["results"]: assert "actions" in bill assert len(bill["actions"]) > 0 - + for action in bill["actions"]: action_id = action.pop("id") assert uuid.UUID(action_id) assert action["description"] - assert action["date"] + assert action["date"] assert isinstance(action["classification"], list) assert isinstance(action["organization"], dict) assert isinstance(action["related_entities"], list) - + assert "id" in action["organization"] org_id = action["organization"]["id"] assert isinstance(org_id, str) @@ -437,4 +437,4 @@ def test_bills_include_actions(client): for entity in action["related_entities"]: assert "id" in entity assert "name" in entity - assert "type" in entity \ No newline at end of file + assert "type" in entity