Skip to content

Commit 77544a3

Browse files
committed
style: satisfy pre-commit gate
1 parent f6ef9c8 commit 77544a3

15 files changed

+41
-37
lines changed

scripts/check_rpc_health.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def extract_id_recursive(data: Any) -> str | None:
148148
"""
149149
if data is None:
150150
return None
151-
if isinstance(data, (str, int)):
151+
if isinstance(data, str | int):
152152
return str(data)
153153
if isinstance(data, list) and len(data) > 0:
154154
return extract_id_recursive(data[0])

src/notebooklm/_core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ def is_auth_error(error: Exception) -> bool:
6060

6161
# Don't treat network/rate limit/server errors as auth errors
6262
# even if they're subclasses of RPCError
63-
if isinstance(error, (NetworkError, RPCTimeoutError, RateLimitError, ServerError, ClientError)):
63+
if isinstance(
64+
error,
65+
NetworkError | RPCTimeoutError | RateLimitError | ServerError | ClientError,
66+
):
6467
return False
6568

6669
# HTTP 401/403 are auth errors

tests/e2e/conftest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ def assert_generation_started(result, artifact_type: str = "Artifact") -> None:
6262
pytest.skip("Rate limited by API")
6363

6464
assert result.task_id, f"{artifact_type} generation failed: {result.error}"
65-
assert result.status in ("pending", "in_progress"), (
66-
f"Unexpected {artifact_type.lower()} status: {result.status}"
67-
)
65+
assert result.status in (
66+
"pending",
67+
"in_progress",
68+
), f"Unexpected {artifact_type.lower()} status: {result.status}"
6869

6970

7071
def has_auth() -> bool:

tests/e2e/test_chat.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,9 @@ async def test_reference_source_ids_exist_in_notebook(self, client, multi_source
307307

308308
# All reference source IDs should exist in the notebook
309309
for ref in result.references:
310-
assert ref.source_id in source_ids, (
311-
f"Reference source_id {ref.source_id} not found in notebook sources"
312-
)
310+
assert (
311+
ref.source_id in source_ids
312+
), f"Reference source_id {ref.source_id} not found in notebook sources"
313313

314314
@pytest.mark.asyncio
315315
async def test_cited_text_matches_source_content(self, client, multi_source_notebook_id):

tests/e2e/test_research_import_verification.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ def test_import_sources_filters_empty_urls():
127127
valid_sources = [s for s in sources_mixed if s.get("url")]
128128

129129
# Should only have 1 valid source
130-
assert len(valid_sources) == 1, (
131-
f"Expected 1 valid source after filtering, got {len(valid_sources)}"
132-
)
130+
assert (
131+
len(valid_sources) == 1
132+
), f"Expected 1 valid source after filtering, got {len(valid_sources)}"
133133
assert valid_sources[0]["url"] == "https://example.com/valid"
134134
assert valid_sources[0]["title"] == "Valid Source"

tests/e2e/test_source_selection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ async def test_notebook_has_multiple_sources(self, client, multi_source_notebook
215215
"""Verify the test notebook has at least 3 sources."""
216216
sources = await client.sources.list(multi_source_notebook_id)
217217

218-
assert len(sources) >= 3, (
219-
f"Expected at least 3 sources for multi-source tests, got {len(sources)}"
220-
)
218+
assert (
219+
len(sources) >= 3
220+
), f"Expected at least 3 sources for multi-source tests, got {len(sources)}"
221221

222222
# Verify each source has an ID
223223
for source in sources:

tests/integration/cli_vcr/test_artifacts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_artifact_list(self, runner, mock_auth_for_vcr, mock_context, json_flag)
2929
if json_flag and result.exit_code == 0:
3030
data = parse_json_output(result.output)
3131
assert data is not None, "Expected valid JSON output"
32-
assert isinstance(data, (list, dict))
32+
assert isinstance(data, list | dict)
3333

3434

3535
class TestArtifactListByType:

tests/integration/cli_vcr/test_chat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_ask_question_json(self, runner, mock_auth_for_vcr, mock_context):
3232
if result.exit_code == 0:
3333
data = parse_json_output(result.output)
3434
assert data is not None, "Expected valid JSON output"
35-
assert isinstance(data, (list, dict))
35+
assert isinstance(data, list | dict)
3636

3737

3838
class TestHistoryCommand:

tests/integration/cli_vcr/test_notebooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_list_notebooks_json(self, runner, mock_auth_for_vcr):
3232

3333
data = parse_json_output(result.output)
3434
assert data is not None, "Expected valid JSON output"
35-
assert isinstance(data, (list, dict))
35+
assert isinstance(data, list | dict)
3636

3737

3838
class TestSummaryCommand:

tests/integration/cli_vcr/test_sources.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_source_list(self, runner, mock_auth_for_vcr, mock_context, json_flag):
2929
if json_flag and result.exit_code == 0:
3030
data = parse_json_output(result.output)
3131
assert data is not None, "Expected valid JSON output"
32-
assert isinstance(data, (list, dict))
32+
assert isinstance(data, list | dict)
3333

3434

3535
class TestSourceAddCommand:

0 commit comments

Comments
 (0)