Skip to content

Commit 21ce632

Browse files
Apply ruff format to fork-guard sites and trigger-preamble tests
run-tests.sh's ruff format check flagged drift in connection.py / pool.py / test_split_trigger_preamble_quotes_and_parens.py. Pure formatting — no behavior change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 65417ca commit 21ce632

3 files changed

Lines changed: 10 additions & 40 deletions

File tree

src/dqliteclient/connection.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,8 +1260,7 @@ def _check_in_use(self) -> None:
12601260
"""Raise on misuse: wrong event loop, concurrent access, or use after pool release."""
12611261
if os.getpid() != self._creator_pid:
12621262
raise InterfaceError(
1263-
"Connection used after fork; reconstruct from configuration "
1264-
"in the target process."
1263+
"Connection used after fork; reconstruct from configuration in the target process."
12651264
)
12661265
if self._pool_released:
12671266
raise InterfaceError(

src/dqliteclient/pool.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,7 @@ async def initialize(self) -> None:
318318
"""
319319
if os.getpid() != self._creator_pid:
320320
raise InterfaceError(
321-
"Pool used after fork; reconstruct from configuration "
322-
"in the target process."
321+
"Pool used after fork; reconstruct from configuration in the target process."
323322
)
324323
# Hold the lock across the gather so a second concurrent
325324
# initialize() call observes _initialized=True after the first
@@ -671,8 +670,7 @@ async def acquire(self) -> AsyncIterator[DqliteConnection]:
671670
"""Acquire a connection from the pool."""
672671
if os.getpid() != self._creator_pid:
673672
raise InterfaceError(
674-
"Pool used after fork; reconstruct from configuration "
675-
"in the target process."
673+
"Pool used after fork; reconstruct from configuration in the target process."
676674
)
677675
if self._closed:
678676
raise DqliteConnectionError("Pool is closed")

tests/test_split_trigger_preamble_quotes_and_parens.py

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -51,68 +51,41 @@ def test_nested_when_clauses(self) -> None:
5151

5252
class TestPreambleQuotedIdentifiers:
5353
def test_double_quoted_table_name_in_preamble(self) -> None:
54-
sql = (
55-
'CREATE TRIGGER aud AFTER INSERT ON "my table" BEGIN\n'
56-
" UPDATE y SET v=1;\n"
57-
"END;"
58-
)
54+
sql = 'CREATE TRIGGER aud AFTER INSERT ON "my table" BEGIN\n UPDATE y SET v=1;\nEND;'
5955
pieces = _split_top_level_statements(sql)
6056
assert len(pieces) == 1, f"got {len(pieces)} pieces: {pieces!r}"
6157

6258
def test_double_quoted_with_doubled_quote_escape(self) -> None:
6359
# SQLite identifier quoting: "" inside "..." is a literal "
64-
sql = (
65-
'CREATE TRIGGER aud AFTER INSERT ON "weird""name" BEGIN\n'
66-
" UPDATE y SET v=1;\n"
67-
"END;"
68-
)
60+
sql = 'CREATE TRIGGER aud AFTER INSERT ON "weird""name" BEGIN\n UPDATE y SET v=1;\nEND;'
6961
pieces = _split_top_level_statements(sql)
7062
assert len(pieces) == 1
7163

7264
def test_bracketed_table_name_in_preamble(self) -> None:
73-
sql = (
74-
"CREATE TRIGGER aud AFTER INSERT ON [my table] BEGIN\n"
75-
" UPDATE y SET v=1;\n"
76-
"END;"
77-
)
65+
sql = "CREATE TRIGGER aud AFTER INSERT ON [my table] BEGIN\n UPDATE y SET v=1;\nEND;"
7866
pieces = _split_top_level_statements(sql)
7967
assert len(pieces) == 1
8068

8169
def test_backtick_table_name_in_preamble(self) -> None:
82-
sql = (
83-
"CREATE TRIGGER aud AFTER INSERT ON `my table` BEGIN\n"
84-
" UPDATE y SET v=1;\n"
85-
"END;"
86-
)
70+
sql = "CREATE TRIGGER aud AFTER INSERT ON `my table` BEGIN\n UPDATE y SET v=1;\nEND;"
8771
pieces = _split_top_level_statements(sql)
8872
assert len(pieces) == 1
8973

9074
def test_backtick_with_doubled_backtick_escape(self) -> None:
91-
sql = (
92-
"CREATE TRIGGER aud AFTER INSERT ON `weird``name` BEGIN\n"
93-
" UPDATE y SET v=1;\n"
94-
"END;"
95-
)
75+
sql = "CREATE TRIGGER aud AFTER INSERT ON `weird``name` BEGIN\n UPDATE y SET v=1;\nEND;"
9676
pieces = _split_top_level_statements(sql)
9777
assert len(pieces) == 1
9878

9979

10080
class TestPreambleComments:
10181
def test_line_comment_between_trigger_and_begin(self) -> None:
10282
sql = (
103-
"CREATE TRIGGER aud AFTER INSERT ON x -- migration v3\n"
104-
"BEGIN\n"
105-
" UPDATE y SET v=1;\n"
106-
"END;"
83+
"CREATE TRIGGER aud AFTER INSERT ON x -- migration v3\nBEGIN\n UPDATE y SET v=1;\nEND;"
10784
)
10885
pieces = _split_top_level_statements(sql)
10986
assert len(pieces) == 1
11087

11188
def test_block_comment_between_trigger_and_begin(self) -> None:
112-
sql = (
113-
"CREATE TRIGGER aud AFTER INSERT ON x /* notes */ BEGIN\n"
114-
" UPDATE y SET v=1;\n"
115-
"END;"
116-
)
89+
sql = "CREATE TRIGGER aud AFTER INSERT ON x /* notes */ BEGIN\n UPDATE y SET v=1;\nEND;"
11790
pieces = _split_top_level_statements(sql)
11891
assert len(pieces) == 1

0 commit comments

Comments
 (0)