proper row interation
Some checks failed
Mypy / mypy (push) Successful in 1m14s
Pytest / pytest (3.12) (push) Successful in 1m20s
Pytest / pytest (3.13) (push) Successful in 1m11s
Pytest / pytest (3.14) (push) Successful in 1m16s
Ruff / ruff (push) Successful in 1m2s
Ruff / ruff (pull_request) Waiting to run
Mypy / mypy (pull_request) Successful in 1m13s
Pytest / pytest (3.12) (pull_request) Has been cancelled
Pytest / pytest (3.13) (pull_request) Has been cancelled
Pytest / pytest (3.14) (pull_request) Has been cancelled

This commit is contained in:
Justus Kuhlmann 2026-04-15 12:02:03 +02:00
commit b625bf9243
Signed by: jkuhl
GPG key ID: 00ED992DD79B85A6

View file

@ -5,7 +5,7 @@ import pandas as pd
import sqlite3 import sqlite3
def has_valid_times(result: pd.DataFrame) -> bool: def has_valid_times(result: pd.Series) -> bool:
# we expect created_at <= updated_at <= now # we expect created_at <= updated_at <= now
created_at = dt.datetime.fromisoformat(result['created_at']) created_at = dt.datetime.fromisoformat(result['created_at'])
updated_at = dt.datetime.fromisoformat(result['updated_at']) updated_at = dt.datetime.fromisoformat(result['updated_at'])
@ -34,7 +34,7 @@ def check_db_integrity(path: Path) -> None:
conn = sqlite3.connect(db) conn = sqlite3.connect(db)
results = pd.read_sql(search_expr, conn) results = pd.read_sql(search_expr, conn)
for result in results: for _, result in results.iterrows():
if not has_valid_times(result): if not has_valid_times(result):
raise ValueError(f"Result with id {result[id]} has wrong time signatures.") raise ValueError(f"Result with id {result[id]} has wrong time signatures.")