refactor: convert f-string logging to lazy %-style format (G004)
Sweep all 1676 G004 violations across 112 files, converting
`logger.<level>(f"…{x}…")` to `logger.<level>("…%s…", x)`.
Why: ruff rule G004 was added to pyproject.toml to enforce lazy
%-style logging — defers formatting until the log level is enabled
and lets structured log tooling match the unformatted template.
Conversion preserves rendered output byte-for-byte:
- `{x}` → `%s` + `x`
- `{x!r}` / `{x!s}` / `{x!a}` → `%r` / `%s` / `%a`
- Format specs (`{x:.2f}`, `{x:>10}`) → `%s` + `format(x, 'spec')`
(printf-style specs aren't 1:1 with Python format specs, so we
delegate to `format()` to keep identical output)
- Literal `%` → `%%`
- Concatenated f-strings (`f"a {x} " "b"`) flattened
- Trailing kwargs (`exc_info=True`) preserved
Verified:
- `uv run ruff check --select G004` → 0 violations
- `uv run ty check -- nextcloud_mcp_server` → passes
- `uv run pytest tests/unit/` → 1010 passed
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
a4e6125d28
commit
665cb9b1eb
@@ -44,29 +44,29 @@ async def temporary_event(nc_client: NextcloudClient, temporary_calendar: str):
|
||||
}
|
||||
|
||||
try:
|
||||
logger.info(f"Creating temporary event in calendar: {calendar_name}")
|
||||
logger.info("Creating temporary event in calendar: %s", calendar_name)
|
||||
result = await nc_client.calendar.create_event(calendar_name, event_data)
|
||||
event_uid = result.get("uid")
|
||||
|
||||
if not event_uid:
|
||||
pytest.fail("Failed to create temporary event")
|
||||
|
||||
logger.info(f"Created temporary event with UID: {event_uid}")
|
||||
logger.info("Created temporary event with UID: %s", event_uid)
|
||||
yield {"uid": event_uid, "calendar_name": calendar_name, "data": event_data}
|
||||
|
||||
finally:
|
||||
# Cleanup
|
||||
if event_uid:
|
||||
try:
|
||||
logger.info(f"Cleaning up temporary event: {event_uid}")
|
||||
logger.info("Cleaning up temporary event: %s", event_uid)
|
||||
await nc_client.calendar.delete_event(calendar_name, event_uid)
|
||||
logger.info(f"Successfully deleted temporary event: {event_uid}")
|
||||
logger.info("Successfully deleted temporary event: %s", event_uid)
|
||||
except HTTPStatusError as e:
|
||||
if e.response.status_code != 404:
|
||||
logger.error(f"Error deleting temporary event {event_uid}: {e}")
|
||||
logger.error("Error deleting temporary event %s: %s", event_uid, e)
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
f"Unexpected error deleting temporary event {event_uid}: {e}"
|
||||
"Unexpected error deleting temporary event %s: %s", event_uid, e
|
||||
)
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ async def test_list_calendars(nc_client: NextcloudClient):
|
||||
if not calendars:
|
||||
pytest.skip("No calendars available - Calendar app may not be enabled")
|
||||
|
||||
logger.info(f"Found {len(calendars)} calendars")
|
||||
logger.info("Found %s calendars", len(calendars))
|
||||
|
||||
# Check structure of calendars
|
||||
for calendar in calendars:
|
||||
@@ -90,7 +90,7 @@ async def test_list_calendars(nc_client: NextcloudClient):
|
||||
assert "description" in calendar
|
||||
assert "color" in calendar
|
||||
|
||||
logger.info(f"Calendar: {calendar['name']} - {calendar['display_name']}")
|
||||
logger.info("Calendar: %s - %s", calendar["name"], calendar["display_name"])
|
||||
|
||||
|
||||
async def test_create_and_delete_event(
|
||||
@@ -118,7 +118,7 @@ async def test_create_and_delete_event(
|
||||
assert result["status_code"] in [200, 201, 204]
|
||||
|
||||
event_uid = result["uid"]
|
||||
logger.info(f"Created event with UID: {event_uid}")
|
||||
logger.info("Created event with UID: %s", event_uid)
|
||||
|
||||
# Verify event was created by retrieving it
|
||||
retrieved_event, etag = await nc_client.calendar.get_event(
|
||||
@@ -132,10 +132,10 @@ async def test_create_and_delete_event(
|
||||
delete_result = await nc_client.calendar.delete_event(calendar_name, event_uid)
|
||||
assert delete_result["status_code"] in [200, 204, 404]
|
||||
|
||||
logger.info(f"Successfully deleted event: {event_uid}")
|
||||
logger.info("Successfully deleted event: %s", event_uid)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Test failed: {e}")
|
||||
logger.error("Test failed: %s", e)
|
||||
raise
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ async def test_create_all_day_event(
|
||||
try:
|
||||
result = await nc_client.calendar.create_event(calendar_name, event_data)
|
||||
event_uid = result["uid"]
|
||||
logger.info(f"Created all-day event with UID: {event_uid}")
|
||||
logger.info("Created all-day event with UID: %s", event_uid)
|
||||
|
||||
# Verify event
|
||||
retrieved_event, _ = await nc_client.calendar.get_event(
|
||||
@@ -170,7 +170,7 @@ async def test_create_all_day_event(
|
||||
await nc_client.calendar.delete_event(calendar_name, event_uid)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"All-day event test failed: {e}")
|
||||
logger.error("All-day event test failed: %s", e)
|
||||
raise
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ async def test_create_recurring_event(
|
||||
try:
|
||||
result = await nc_client.calendar.create_event(calendar_name, event_data)
|
||||
event_uid = result["uid"]
|
||||
logger.info(f"Created recurring event with UID: {event_uid}")
|
||||
logger.info("Created recurring event with UID: %s", event_uid)
|
||||
|
||||
# Verify event
|
||||
retrieved_event, _ = await nc_client.calendar.get_event(
|
||||
@@ -207,7 +207,7 @@ async def test_create_recurring_event(
|
||||
await nc_client.calendar.delete_event(calendar_name, event_uid)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Recurring event test failed: {e}")
|
||||
logger.error("Recurring event test failed: %s", e)
|
||||
raise
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ async def test_list_events_in_range(nc_client: NextcloudClient, temporary_event:
|
||||
)
|
||||
|
||||
assert isinstance(events, list)
|
||||
logger.info(f"Found {len(events)} events in date range")
|
||||
logger.info("Found %s events in date range", len(events))
|
||||
|
||||
# Our temporary event should be in the list
|
||||
event_uids = [event.get("uid") for event in events]
|
||||
@@ -266,10 +266,10 @@ async def test_update_event(nc_client: NextcloudClient, temporary_event: dict):
|
||||
assert updated_event["location"] == "Updated Location"
|
||||
assert updated_event["priority"] == 1
|
||||
|
||||
logger.info(f"Successfully updated event: {event_uid}")
|
||||
logger.info("Successfully updated event: %s", event_uid)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Event update test failed: {e}")
|
||||
logger.error("Event update test failed: %s", e)
|
||||
raise
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ async def test_update_event_extended_fields(
|
||||
try:
|
||||
result = await nc_client.calendar.create_event(calendar_name, event_data)
|
||||
event_uid = result["uid"]
|
||||
logger.info(f"Created base event for extended fields test: {event_uid}")
|
||||
logger.info("Created base event for extended fields test: %s", event_uid)
|
||||
|
||||
# --- Phase 1: Set all four extended fields ---
|
||||
updated_data = {
|
||||
@@ -343,7 +343,7 @@ async def test_update_event_extended_fields(
|
||||
logger.info("Phase 2 passed: all extended fields cleared correctly")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Extended fields update test failed: {e}")
|
||||
logger.error("Extended fields update test failed: %s", e)
|
||||
raise
|
||||
finally:
|
||||
if event_uid:
|
||||
@@ -374,7 +374,7 @@ async def test_create_event_with_attendees(
|
||||
try:
|
||||
result = await nc_client.calendar.create_event(calendar_name, event_data)
|
||||
event_uid = result["uid"]
|
||||
logger.info(f"Created event with attendees, UID: {event_uid}")
|
||||
logger.info("Created event with attendees, UID: %s", event_uid)
|
||||
|
||||
# Verify event
|
||||
retrieved_event, _ = await nc_client.calendar.get_event(
|
||||
@@ -388,7 +388,7 @@ async def test_create_event_with_attendees(
|
||||
await nc_client.calendar.delete_event(calendar_name, event_uid)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Event with attendees test failed: {e}")
|
||||
logger.error("Event with attendees test failed: %s", e)
|
||||
raise
|
||||
|
||||
|
||||
@@ -403,7 +403,7 @@ async def test_get_nonexistent_event(
|
||||
with pytest.raises(Exception, match="not found"):
|
||||
await nc_client.calendar.get_event(calendar_name, fake_uid)
|
||||
|
||||
logger.info(f"Correctly raised exception for nonexistent event: {fake_uid}")
|
||||
logger.info("Correctly raised exception for nonexistent event: %s", fake_uid)
|
||||
|
||||
|
||||
async def test_delete_nonexistent_event(
|
||||
@@ -415,7 +415,7 @@ async def test_delete_nonexistent_event(
|
||||
|
||||
result = await nc_client.calendar.delete_event(calendar_name, fake_uid)
|
||||
assert result["status_code"] == 404
|
||||
logger.info(f"Correctly got 404 for deleting nonexistent event: {fake_uid}")
|
||||
logger.info("Correctly got 404 for deleting nonexistent event: %s", fake_uid)
|
||||
|
||||
|
||||
async def test_event_with_url_and_categories(
|
||||
@@ -439,7 +439,7 @@ async def test_event_with_url_and_categories(
|
||||
try:
|
||||
result = await nc_client.calendar.create_event(calendar_name, event_data)
|
||||
event_uid = result["uid"]
|
||||
logger.info(f"Created event with metadata, UID: {event_uid}")
|
||||
logger.info("Created event with metadata, UID: %s", event_uid)
|
||||
|
||||
# Verify event
|
||||
retrieved_event, _ = await nc_client.calendar.get_event(
|
||||
@@ -456,7 +456,7 @@ async def test_event_with_url_and_categories(
|
||||
await nc_client.calendar.delete_event(calendar_name, event_uid)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Event with metadata test failed: {e}")
|
||||
logger.error("Event with metadata test failed: %s", e)
|
||||
raise
|
||||
|
||||
|
||||
@@ -485,7 +485,7 @@ async def test_list_events_date_range_filtering(
|
||||
calendar_name, past_event_data
|
||||
)
|
||||
past_uid = result_past["uid"]
|
||||
logger.info(f"Created past event: {past_uid}")
|
||||
logger.info("Created past event: %s", past_uid)
|
||||
|
||||
# Create Event B: 1 day in the future
|
||||
future_date = datetime.now() + timedelta(days=1)
|
||||
@@ -499,7 +499,7 @@ async def test_list_events_date_range_filtering(
|
||||
calendar_name, future_event_data
|
||||
)
|
||||
future_uid = result_future["uid"]
|
||||
logger.info(f"Created future event: {future_uid}")
|
||||
logger.info("Created future event: %s", future_uid)
|
||||
|
||||
# Query with date range: today → 7 days ahead
|
||||
now = datetime.now()
|
||||
@@ -526,8 +526,8 @@ async def test_list_events_date_range_filtering(
|
||||
)
|
||||
|
||||
logger.info(
|
||||
f"Date range filtering works: {len(events)} events returned, "
|
||||
f"past event correctly excluded"
|
||||
"Date range filtering works: %s events returned, past event correctly excluded",
|
||||
len(events),
|
||||
)
|
||||
|
||||
finally:
|
||||
@@ -537,7 +537,7 @@ async def test_list_events_date_range_filtering(
|
||||
try:
|
||||
await nc_client.calendar.delete_event(calendar_name, uid)
|
||||
except Exception as e:
|
||||
logger.warning(f"Cleanup failed for event {uid}: {e}")
|
||||
logger.warning("Cleanup failed for event %s: %s", uid, e)
|
||||
|
||||
|
||||
async def test_recurring_event_date_range_expansion(
|
||||
@@ -569,7 +569,7 @@ async def test_recurring_event_date_range_expansion(
|
||||
}
|
||||
result = await nc_client.calendar.create_event(calendar_name, event_data)
|
||||
event_uid = result["uid"]
|
||||
logger.info(f"Created daily recurring event: {event_uid}")
|
||||
logger.info("Created daily recurring event: %s", event_uid)
|
||||
|
||||
# Query with date range: today → 3 days ahead
|
||||
query_start = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
|
||||
@@ -619,8 +619,8 @@ async def test_recurring_event_date_range_expansion(
|
||||
)
|
||||
|
||||
logger.info(
|
||||
f"Recurring event expansion works: {len(our_events)} occurrences "
|
||||
f"returned with unique start dates"
|
||||
"Recurring event expansion works: %s occurrences returned with unique start dates",
|
||||
len(our_events),
|
||||
)
|
||||
|
||||
finally:
|
||||
@@ -628,7 +628,9 @@ async def test_recurring_event_date_range_expansion(
|
||||
try:
|
||||
await nc_client.calendar.delete_event(calendar_name, event_uid)
|
||||
except Exception as e:
|
||||
logger.warning(f"Cleanup failed for recurring event {event_uid}: {e}")
|
||||
logger.warning(
|
||||
"Cleanup failed for recurring event %s: %s", event_uid, e
|
||||
)
|
||||
|
||||
|
||||
async def test_calendar_operations_error_handling(
|
||||
|
||||
@@ -68,7 +68,7 @@ END:VCALENDAR"""
|
||||
event.data = custom_ical
|
||||
await event.save()
|
||||
|
||||
logger.info(f"Injected custom iCal properties into event {event_uid}")
|
||||
logger.info("Injected custom iCal properties into event %s", event_uid)
|
||||
|
||||
# Reload the event to confirm custom fields are present
|
||||
await event.load()
|
||||
@@ -91,7 +91,7 @@ END:VCALENDAR"""
|
||||
}
|
||||
|
||||
await nc_client.calendar.update_event(calendar_name, event_uid, update_data)
|
||||
logger.info(f"Updated event {event_uid} through MCP client")
|
||||
logger.info("Updated event %s through MCP client", event_uid)
|
||||
|
||||
# Reload the event to see if custom fields survived
|
||||
await event.load()
|
||||
@@ -117,7 +117,7 @@ END:VCALENDAR"""
|
||||
try:
|
||||
await nc_client.calendar.delete_event(calendar_name, event_uid)
|
||||
except Exception as cleanup_error:
|
||||
logger.warning(f"Failed to cleanup event {event_uid}: {cleanup_error}")
|
||||
logger.warning("Failed to cleanup event %s: %s", event_uid, cleanup_error)
|
||||
|
||||
|
||||
@pytest.mark.integration
|
||||
@@ -145,7 +145,7 @@ async def test_contact_extended_fields_preservation(nc_client):
|
||||
contact_data=basic_contact_data,
|
||||
)
|
||||
|
||||
logger.info(f"Created basic contact {contact_uid}")
|
||||
logger.info("Created basic contact %s", contact_uid)
|
||||
|
||||
# Now inject a rich vCard with extended fields directly via CardDAV
|
||||
extended_vcard = f"""BEGIN:VCARD
|
||||
@@ -182,7 +182,7 @@ END:VCARD"""
|
||||
headers={"Content-Type": "text/vcard; charset=utf-8"},
|
||||
)
|
||||
|
||||
logger.info(f"Injected extended vCard for contact {contact_uid}")
|
||||
logger.info("Injected extended vCard for contact %s", contact_uid)
|
||||
|
||||
# Retrieve the contact to confirm extended fields are present in raw vCard
|
||||
response = await nc_client.contacts._make_request("GET", contact_path)
|
||||
@@ -232,7 +232,7 @@ END:VCARD"""
|
||||
)
|
||||
logger.info("✓ Contact updated successfully")
|
||||
except Exception as e:
|
||||
logger.error(f"✗ Failed to update contact: {e}")
|
||||
logger.error("✗ Failed to update contact: %s", e)
|
||||
raise
|
||||
|
||||
# Retrieve the contact again to see if extended fields survived
|
||||
@@ -268,9 +268,9 @@ END:VCARD"""
|
||||
all_preserved = True
|
||||
for field_pattern, field_name in extended_field_checks:
|
||||
if field_pattern in updated_addressdata:
|
||||
logger.info(f"✓ {field_name} preserved")
|
||||
logger.info("✓ %s preserved", field_name)
|
||||
else:
|
||||
logger.error(f"✗ {field_name} was lost during update")
|
||||
logger.error("✗ %s was lost during update", field_name)
|
||||
all_preserved = False
|
||||
|
||||
# The test should PASS - field preservation should work
|
||||
@@ -286,7 +286,7 @@ END:VCARD"""
|
||||
await nc_client.contacts.delete_addressbook(name=addressbook_name)
|
||||
except Exception as cleanup_error:
|
||||
logger.warning(
|
||||
f"Failed to cleanup addressbook {addressbook_name}: {cleanup_error}"
|
||||
"Failed to cleanup addressbook %s: %s", addressbook_name, cleanup_error
|
||||
)
|
||||
|
||||
|
||||
@@ -415,9 +415,9 @@ END:VCALENDAR"""
|
||||
else:
|
||||
lost.append(prop)
|
||||
|
||||
logger.info(f"Properties that SURVIVED: {survived}")
|
||||
logger.info("Properties that SURVIVED: %s", survived)
|
||||
if lost:
|
||||
logger.error(f"Properties that were LOST: {lost}")
|
||||
logger.error("Properties that were LOST: %s", lost)
|
||||
|
||||
# Assert that all extended properties were preserved
|
||||
assert len(lost) == 0, (
|
||||
@@ -430,4 +430,4 @@ END:VCALENDAR"""
|
||||
try:
|
||||
await nc_client.calendar.delete_event(calendar_name, event_uid)
|
||||
except Exception as cleanup_error:
|
||||
logger.warning(f"Failed to cleanup event {event_uid}: {cleanup_error}")
|
||||
logger.warning("Failed to cleanup event %s: %s", event_uid, cleanup_error)
|
||||
|
||||
@@ -33,29 +33,29 @@ async def temporary_todo(nc_client: NextcloudClient, temporary_calendar: str):
|
||||
}
|
||||
|
||||
try:
|
||||
logger.info(f"Creating temporary todo in calendar: {calendar_name}")
|
||||
logger.info("Creating temporary todo in calendar: %s", calendar_name)
|
||||
result = await nc_client.calendar.create_todo(calendar_name, todo_data)
|
||||
todo_uid = result.get("uid")
|
||||
|
||||
if not todo_uid:
|
||||
pytest.fail("Failed to create temporary todo")
|
||||
|
||||
logger.info(f"Created temporary todo with UID: {todo_uid}")
|
||||
logger.info("Created temporary todo with UID: %s", todo_uid)
|
||||
yield {"uid": todo_uid, "calendar_name": calendar_name, "data": todo_data}
|
||||
|
||||
finally:
|
||||
# Cleanup
|
||||
if todo_uid:
|
||||
try:
|
||||
logger.info(f"Cleaning up temporary todo: {todo_uid}")
|
||||
logger.info("Cleaning up temporary todo: %s", todo_uid)
|
||||
await nc_client.calendar.delete_todo(calendar_name, todo_uid)
|
||||
logger.info(f"Successfully deleted temporary todo: {todo_uid}")
|
||||
logger.info("Successfully deleted temporary todo: %s", todo_uid)
|
||||
except HTTPStatusError as e:
|
||||
if e.response.status_code != 404:
|
||||
logger.error(f"Error deleting temporary todo {todo_uid}: {e}")
|
||||
logger.error("Error deleting temporary todo %s: %s", todo_uid, e)
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
f"Unexpected error deleting temporary todo {todo_uid}: {e}"
|
||||
"Unexpected error deleting temporary todo %s: %s", todo_uid, e
|
||||
)
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ async def test_create_and_delete_todo(
|
||||
assert result["status_code"] in [200, 201, 204]
|
||||
|
||||
todo_uid = result["uid"]
|
||||
logger.info(f"Created todo with UID: {todo_uid}")
|
||||
logger.info("Created todo with UID: %s", todo_uid)
|
||||
|
||||
# Verify todo was created by listing todos
|
||||
todos = await nc_client.calendar.list_todos(calendar_name)
|
||||
@@ -103,10 +103,10 @@ async def test_create_and_delete_todo(
|
||||
delete_result = await nc_client.calendar.delete_todo(calendar_name, todo_uid)
|
||||
assert delete_result["status_code"] in [200, 204, 404]
|
||||
|
||||
logger.info(f"Successfully deleted todo: {todo_uid}")
|
||||
logger.info("Successfully deleted todo: %s", todo_uid)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Test failed: {e}")
|
||||
logger.error("Test failed: %s", e)
|
||||
raise
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ async def test_list_todos(nc_client: NextcloudClient, temporary_calendar: str):
|
||||
for uid in todo_uids:
|
||||
assert uid in listed_uids
|
||||
|
||||
logger.info(f"Found {len(todos)} todos in calendar")
|
||||
logger.info("Found %s todos in calendar", len(todos))
|
||||
|
||||
finally:
|
||||
# Cleanup
|
||||
@@ -187,10 +187,10 @@ async def test_update_todo(nc_client: NextcloudClient, temporary_todo: dict):
|
||||
assert updated_todo["priority"] == 1
|
||||
assert updated_todo["percent_complete"] == 50
|
||||
|
||||
logger.info(f"Successfully updated todo: {todo_uid}")
|
||||
logger.info("Successfully updated todo: %s", todo_uid)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Todo update test failed: {e}")
|
||||
logger.error("Todo update test failed: %s", e)
|
||||
raise
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ async def test_todo_with_dates(nc_client: NextcloudClient, temporary_calendar: s
|
||||
try:
|
||||
result = await nc_client.calendar.create_todo(calendar_name, todo_data)
|
||||
todo_uid = result["uid"]
|
||||
logger.info(f"Created todo with dates, UID: {todo_uid}")
|
||||
logger.info("Created todo with dates, UID: %s", todo_uid)
|
||||
|
||||
# Verify dates
|
||||
todos = await nc_client.calendar.list_todos(calendar_name)
|
||||
@@ -228,7 +228,7 @@ async def test_todo_with_dates(nc_client: NextcloudClient, temporary_calendar: s
|
||||
await nc_client.calendar.delete_todo(calendar_name, todo_uid)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Date handling test failed: {e}")
|
||||
logger.error("Date handling test failed: %s", e)
|
||||
raise
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ async def test_todo_status_transitions(
|
||||
assert todo["percent_complete"] == 100
|
||||
assert "completed" in todo
|
||||
|
||||
logger.info(f"Successfully transitioned todo through statuses: {todo_uid}")
|
||||
logger.info("Successfully transitioned todo through statuses: %s", todo_uid)
|
||||
|
||||
finally:
|
||||
await nc_client.calendar.delete_todo(calendar_name, todo_uid)
|
||||
@@ -315,7 +315,7 @@ async def test_todo_priority_levels(
|
||||
assert todo is not None
|
||||
assert todo["priority"] == expected_priority
|
||||
|
||||
logger.info(f"Successfully tested priority levels: {priorities}")
|
||||
logger.info("Successfully tested priority levels: %s", priorities)
|
||||
|
||||
finally:
|
||||
# Cleanup
|
||||
@@ -342,7 +342,7 @@ async def test_todo_with_categories(
|
||||
try:
|
||||
result = await nc_client.calendar.create_todo(calendar_name, todo_data)
|
||||
todo_uid = result["uid"]
|
||||
logger.info(f"Created todo with categories, UID: {todo_uid}")
|
||||
logger.info("Created todo with categories, UID: %s", todo_uid)
|
||||
|
||||
# Verify categories
|
||||
todos = await nc_client.calendar.list_todos(calendar_name)
|
||||
@@ -360,7 +360,7 @@ async def test_todo_with_categories(
|
||||
await nc_client.calendar.delete_todo(calendar_name, todo_uid)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Categories test failed: {e}")
|
||||
logger.error("Categories test failed: %s", e)
|
||||
raise
|
||||
|
||||
|
||||
@@ -399,7 +399,7 @@ async def test_search_todos_across_calendars(
|
||||
assert todo1["calendar_name"] == cal1_name
|
||||
assert todo2["calendar_name"] == cal2_name
|
||||
|
||||
logger.info(f"Found {len(all_todos)} todos across all calendars")
|
||||
logger.info("Found %s todos across all calendars", len(all_todos))
|
||||
|
||||
finally:
|
||||
# Cleanup: Delete only the todos we created (calendars are reused/built-in)
|
||||
@@ -428,7 +428,7 @@ async def test_get_nonexistent_todo(
|
||||
matching_todos = [t for t in todos if t.get("uid") == fake_uid]
|
||||
assert len(matching_todos) == 0
|
||||
|
||||
logger.info(f"Verified nonexistent todo UID: {fake_uid}")
|
||||
logger.info("Verified nonexistent todo UID: %s", fake_uid)
|
||||
|
||||
|
||||
async def test_delete_nonexistent_todo(
|
||||
@@ -440,7 +440,7 @@ async def test_delete_nonexistent_todo(
|
||||
|
||||
result = await nc_client.calendar.delete_todo(calendar_name, fake_uid)
|
||||
assert result["status_code"] == 404
|
||||
logger.info(f"Correctly got 404 for deleting nonexistent todo: {fake_uid}")
|
||||
logger.info("Correctly got 404 for deleting nonexistent todo: %s", fake_uid)
|
||||
|
||||
|
||||
async def test_list_todos_with_filters(
|
||||
@@ -487,7 +487,7 @@ async def test_list_todos_with_filters(
|
||||
our_todo_uids = [t["uid"] for t in all_todos if t["uid"] in created_uids]
|
||||
assert len(our_todo_uids) == 3
|
||||
|
||||
logger.info(f"Successfully created and listed {len(created_uids)} test todos")
|
||||
logger.info("Successfully created and listed %s test todos", len(created_uids))
|
||||
|
||||
finally:
|
||||
# Cleanup
|
||||
|
||||
Reference in New Issue
Block a user