Use ruff rules COM, F, I, RUF, UP (#17)

* Use pyupgrade (UP) rule

* Use pyflakes (F) rule

* Use isort (I) rule

* Use ruff-specific (RUF) rules

* Use flake8-commas (COM) rule

* Fix UP043 Unnecessary default type arguments
This commit is contained in:
Wei Ji
2025-12-05 10:44:37 +00:00
committed by GitHub
parent 7c97b475e4
commit e3530cefd2
16 changed files with 103 additions and 78 deletions
+8 -6
View File
@@ -1,10 +1,11 @@
import pytest
import pytest_asyncio
from httpx import AsyncClient, ASGITransport
from uuid import uuid4
from geo_assistant.api.app import app
import pytest
import pytest_asyncio
from httpx import ASGITransport, AsyncClient
from geo_assistant.agent.graph import create_graph
from geo_assistant.api.app import app
@pytest_asyncio.fixture
@@ -22,7 +23,8 @@ async def initialized_app():
async def test_hello_world(initialized_app):
"""Hello world test for the API"""
async with AsyncClient(
transport=ASGITransport(app=initialized_app), base_url="http://test"
transport=ASGITransport(app=initialized_app),
base_url="http://test",
) as client:
thread_id = uuid4()
response = await client.post(
@@ -33,7 +35,7 @@ async def test_hello_world(initialized_app):
{
"content": "Find the Neighbourhood Cafe in Lisbon and buffer 0.5km around it",
"type": "human",
}
},
],
"place": None,
"search_area": None,
+4 -3
View File
@@ -1,8 +1,9 @@
from pytest import fixture
from geo_assistant.agent.state import GeoAssistantState
from geo_assistant.tools.buffer import get_search_area
from geojson_pydantic import Feature, Point
from langchain_core.tools.base import ToolCall
from pytest import fixture
from geo_assistant.agent.state import GeoAssistantState
from geo_assistant.tools.buffer import get_search_area
@fixture
+5 -4
View File
@@ -1,7 +1,8 @@
import pytest
from pathlib import Path
from shapely.geometry import box, mapping
import pytest
from langchain_core.tools.base import ToolCall
from shapely.geometry import box, mapping
from geo_assistant.tools.naip import fetch_naip_img
@@ -19,7 +20,7 @@ async def test_fetch_naip(tmp_path):
"""
# Union Market coordinates from GeoNames: 38.90789, -76.99831
# N 38°5428 W 76°5954
# N 38°54'28" W 76°59'54"
# We'll use a small neighborhood AOI around that point.
# :contentReference[oaicite:0]{index=0}
lat = 38.90789
@@ -44,7 +45,7 @@ async def test_fetch_naip(tmp_path):
id="test_tool_call_id",
)
# Call the actual tool no STAC / odc-stac mocking
# Call the actual tool - no STAC / odc-stac mocking
result = await fetch_naip_img.ainvoke(tool_call["args"])
# Basic sanity checks on result
+2 -1
View File
@@ -1,4 +1,5 @@
import os
import pytest
from langchain_core.tools.base import ToolCall
@@ -24,6 +25,6 @@ async def test_get_place():
type="tool_call",
id="test_id",
args={"place_name": "Neighbourhood Cafe Lisbon"},
)
),
)
assert "place" in command.update
+3 -2
View File
@@ -1,9 +1,10 @@
"""Tests for the satellite image summarization tool."""
import pytest
import uuid
import pytest
from langchain_core.tools.base import ToolCall
from geo_assistant.tools.summarize import summarize_sat_img
# Sample test data
@@ -24,7 +25,7 @@ def test_summarize_sat_img(img_url, summary):
type="tool_call",
args={"img_url": img_url},
id=str(uuid.uuid4()),
)
),
)
print(command.update.get("messages"))