Enabled all Ruff linter rules and fixed resulting violations.
CI / Formatting (push) Successful in 5s
CI / Linting (push) Successful in 4s
CI / Tests (push) Successful in 28s
CI / Type Checking (push) Successful in 11s
CI / Spelling (push) Successful in 5s

This commit is contained in:
2026-03-29 20:08:30 -04:00
parent 603a927f12
commit abe1444e4c
16 changed files with 188 additions and 125 deletions
+8 -4
View File
@@ -53,7 +53,7 @@ class TestIsCompleteSentence:
pytest.param("Hello,", False, id="comma"),
],
)
def test_detection(self, sentence: str, expected: bool) -> None:
def test_detection(self, sentence: str, expected: bool) -> None: # noqa: FBT001
"""Correctly identifies sentence completeness."""
assert is_complete_sentence(sentence) is expected
@@ -147,7 +147,9 @@ class TestIngestParagraph:
],
)
async def test_empty_input_stores_nothing(
self, db: Database, paragraph: str
self,
db: Database,
paragraph: str,
) -> None:
"""Empty or whitespace-only input does not store any data."""
await ingest(db, 1, 100, paragraph)
@@ -260,13 +262,15 @@ class TestGenerate:
assert result == "A B C"
async def test_soft_limit_falls_back_to_regular_next_word(
self, db: Database
self,
db: Database,
) -> None:
"""After soft_limit, falls back when no completing word exists."""
# "A" -> "B" (no completing transition). Past soft_limit,
# get_random_completing_next_word returns None, falls back to "B".
await db.add_markov_data(
[StartWord(1, 100, "A")], [Transition(1, 100, "A", "B")]
[StartWord(1, 100, "A")],
[Transition(1, 100, "A", "B")],
)
result = await generate(db, 1, soft_limit=1, hard_limit=1000)