fix: ruff findings

This commit is contained in:
soubarna
2026-10-05 17:28:15 +05:30
parent 2c93874799
commit 3355c20202
44 changed files with 117 additions and 213 deletions
+6 -8
View File
@@ -4,9 +4,8 @@ Tests the idempotent, safe repair of hour observations and day aggregates
from surviving raw samples, boundary anchor retention, and legacy summary
handling at actual precision.
"""
import sqlite3
import sys
from datetime import datetime, timedelta, timezone
from datetime import datetime, timezone
from pathlib import Path
import pytest
@@ -102,7 +101,6 @@ class TestRepairUsesSameEvidenceRules:
def test_repair_idempotent_on_fully_derived(self, store_conn):
"""Repair on store with existing derived data does not duplicate."""
now = datetime(2026, 9, 15, 12, 0, 0, tzinfo=timezone.utc)
_open_period(store_conn, "2026-09-14T00:00:00+00:00")
# Insert samples that span an hour
@@ -138,7 +136,7 @@ class TestRepairUsesSameEvidenceRules:
store_conn.commit()
# Run repair
result = repair_derivation(store_conn)
repair_derivation(store_conn)
# Verify marker preserved
cursor = store_conn.execute(
@@ -265,7 +263,7 @@ class TestBoundaryAnchorRetention:
_insert_sample(store_conn, "2026-09-29T12:00:00+00:00", 3000000)
# Run pruning
pruned = prune_old_samples(store_conn, now, retention_days=14)
prune_old_samples(store_conn, now, retention_days=14)
# The boundary anchor should be retained
cursor = store_conn.execute(
@@ -286,7 +284,7 @@ class TestBoundaryAnchorRetention:
bytes_written_delta=1000000)
# Run pruning
pruned = prune_old_samples(store_conn, now, retention_days=14)
prune_old_samples(store_conn, now, retention_days=14)
# The source remains until local-day evidence is also durable.
cursor = store_conn.execute(
@@ -309,7 +307,7 @@ class TestLegacySummaryPrecision:
bytes_written_delta=5000000)
# Run repair
result = repair_derivation(store_conn)
repair_derivation(store_conn)
# Should not create hour observations for legacy day
cursor = store_conn.execute(
@@ -324,7 +322,7 @@ class TestLegacySummaryPrecision:
bytes_written_delta=5000000)
# Run repair
result = repair_derivation(store_conn)
repair_derivation(store_conn)
# Day aggregate should not be modified
cursor = store_conn.execute(