Skip to content

Commit 9d84695

Browse files
committed
test: test names and docstrings read right after the rename
1 parent f50e743 commit 9d84695

7 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎pg_partsmith/aio/protocols.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ async def truncate_partition(
203203
expected_oid: The catalog identity the caller decided on, checked
204204
under the truncate's own lock. When the relation now holding
205205
the name has another, nothing is emptied; nor is it when the
206-
relation is not attached to ``parent_name``, whatever this is.
206+
relation is not attached to ``parent_name``, with or without it.
207207
208208
Raises:
209209
PartitionNotFoundError: If partition doesn't exist.
@@ -212,7 +212,7 @@ async def truncate_partition(
212212
PartitionTopologyError: If its subtree holds a foreign table, or a
213213
foreign key of another table reaches it (``truncate_blocked``);
214214
nothing is emptied. The executor records this as an issue and
215-
the run goes on, where any other error aborts it.
215+
the run goes on.
216216
"""
217217
...
218218

‎pg_partsmith/aio/repositories/remover.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ async def truncate(self, table_name: str, partition_name: str, *, expected_oid:
255255
async def _ensure_truncate_reaches_nothing_else(self, conn: AsyncConnection, partition_name: str) -> None:
256256
"""Refuse a subtree holding a foreign table, and a partition a foreign key reaches."""
257257
value = (await conn.execute(text(RELATION_OID_SQL), {"name": to_regclass_argument(partition_name)})).scalar()
258-
if value is None: # pragma: no cover - the relation was locked one statement ago
258+
if value is None: # pragma: no cover - the relation was locked earlier in this transaction
259259
raise PartitionNotFoundError(partition_name)
260260
oid = int(value)
261261

‎pg_partsmith/sync/protocols.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def truncate_partition(
203203
expected_oid: The catalog identity the caller decided on, checked
204204
under the truncate's own lock. When the relation now holding
205205
the name has another, nothing is emptied; nor is it when the
206-
relation is not attached to ``parent_name``, whatever this is.
206+
relation is not attached to ``parent_name``, with or without it.
207207
208208
Raises:
209209
PartitionNotFoundError: If partition doesn't exist.
@@ -212,7 +212,7 @@ def truncate_partition(
212212
PartitionTopologyError: If its subtree holds a foreign table, or a
213213
foreign key of another table reaches it (``truncate_blocked``);
214214
nothing is emptied. The executor records this as an issue and
215-
the run goes on, where any other error aborts it.
215+
the run goes on.
216216
"""
217217
...
218218

‎pg_partsmith/sync/repositories/remover.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def truncate(self, table_name: str, partition_name: str, *, expected_oid: int |
256256
def _ensure_truncate_reaches_nothing_else(self, conn: Connection, partition_name: str) -> None:
257257
"""Refuse a subtree holding a foreign table, and a partition a foreign key reaches."""
258258
value = (conn.execute(text(RELATION_OID_SQL), {"name": to_regclass_argument(partition_name)})).scalar()
259-
if value is None: # pragma: no cover - the relation was locked one statement ago
259+
if value is None: # pragma: no cover - the relation was locked earlier in this transaction
260260
raise PartitionNotFoundError(partition_name)
261261
oid = int(value)
262262

‎tests/integration/aio/test_foreign_keys.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ async def test__without_unreferenced__refused_detach_is_an_issue_and_the_run_goe
192192
assert await scalar(db_engine, f'SELECT count(*) FROM "{refs}"') == 1 # noqa: S608
193193

194194

195-
async def test__expire_truncate__parent_referencing_tables_a_foreign_key__a_warning_and_the_rows_stay(
195+
async def test__expire_truncate__parent_referenced_by_a_foreign_key__a_warning_and_the_rows_stay(
196196
db_engine: AsyncEngine, events: str, refs: str
197197
) -> None:
198198
# Arrange -- June is referenced, July is not; PostgreSQL refuses TRUNCATE of either,

‎tests/integration/sync/test_foreign_keys.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def test__without_unreferenced__refused_detach_is_an_issue_and_the_run_goes_on(
189189
assert scalar(sync_db_engine, f'SELECT count(*) FROM "{refs}"') == 1 # noqa: S608
190190

191191

192-
def test__expire_truncate__parent_referencing_tables_a_foreign_key__a_warning_and_the_rows_stay(
192+
def test__expire_truncate__parent_referenced_by_a_foreign_key__a_warning_and_the_rows_stay(
193193
sync_db_engine: Engine, events: str, refs: str
194194
) -> None:
195195
# Arrange -- June is referenced, July is not; PostgreSQL refuses TRUNCATE of either,

‎tests/unit/test_planner.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1633,7 +1633,7 @@ def test__plan_maintenance__expire_truncate__everything_emptied__the_next_plan_i
16331633
assert "keeps 1 expired partition attached" in plan.findings[0].detail
16341634

16351635

1636-
def test__plan_maintenance__expire_truncate__referencing_tables_a_foreign_key__a_warning_and_nothing_planned() -> None:
1636+
def test__plan_maintenance__expire_truncate__referenced_by_a_foreign_key__a_warning_and_nothing_planned() -> None:
16371637
# Arrange: a key on the parent is cloned onto every partition, so TRUNCATE is refused rows or no rows
16381638
config = _truncating(KeepNewest(count=1))
16391639
referenced = PartitionFacts(empty=False, referencing_tables=("public.audit", "public.refunds"))

0 commit comments

Comments
 (0)