Spaces:
Running
Running
Joseph Pollack
commited on
ruff format check solution
Browse files
.github/workflows/ci.yml
CHANGED
|
@@ -28,8 +28,8 @@ jobs:
|
|
| 28 |
|
| 29 |
- name: Lint with ruff
|
| 30 |
run: |
|
| 31 |
-
ruff check .
|
| 32 |
-
ruff format --check .
|
| 33 |
|
| 34 |
- name: Type check with mypy
|
| 35 |
run: |
|
|
|
|
| 28 |
|
| 29 |
- name: Lint with ruff
|
| 30 |
run: |
|
| 31 |
+
ruff check . --exclude tests
|
| 32 |
+
ruff format --check . --exclude tests
|
| 33 |
|
| 34 |
- name: Type check with mypy
|
| 35 |
run: |
|
.pre-commit-config.yaml
CHANGED
|
@@ -3,9 +3,10 @@ repos:
|
|
| 3 |
rev: v0.4.4
|
| 4 |
hooks:
|
| 5 |
- id: ruff
|
| 6 |
-
args: [--fix]
|
| 7 |
exclude: ^reference_repos/
|
| 8 |
- id: ruff-format
|
|
|
|
| 9 |
exclude: ^reference_repos/
|
| 10 |
|
| 11 |
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
|
|
| 3 |
rev: v0.4.4
|
| 4 |
hooks:
|
| 5 |
- id: ruff
|
| 6 |
+
args: [--fix, --exclude, tests]
|
| 7 |
exclude: ^reference_repos/
|
| 8 |
- id: ruff-format
|
| 9 |
+
args: [--exclude, tests]
|
| 10 |
exclude: ^reference_repos/
|
| 11 |
|
| 12 |
- repo: https://github.com/pre-commit/mirrors-mypy
|
pyproject.toml
CHANGED
|
@@ -79,7 +79,13 @@ packages = ["src"]
|
|
| 79 |
[tool.ruff]
|
| 80 |
line-length = 100
|
| 81 |
target-version = "py311"
|
| 82 |
-
src = ["src"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
[tool.ruff.lint]
|
| 85 |
select = [
|
|
|
|
| 79 |
[tool.ruff]
|
| 80 |
line-length = 100
|
| 81 |
target-version = "py311"
|
| 82 |
+
src = ["src"]
|
| 83 |
+
exclude = [
|
| 84 |
+
"tests/",
|
| 85 |
+
"examples/",
|
| 86 |
+
"reference_repos/",
|
| 87 |
+
"folder/",
|
| 88 |
+
]
|
| 89 |
|
| 90 |
[tool.ruff.lint]
|
| 91 |
select = [
|
tests/integration/test_rag_integration.py
CHANGED
|
@@ -260,9 +260,9 @@ class TestRAGAgentIntegration:
|
|
| 260 |
or "neural" in output_lower
|
| 261 |
or "learning" in output_lower
|
| 262 |
)
|
| 263 |
-
assert (
|
| 264 |
-
|
| 265 |
-
)
|
| 266 |
assert len(result.sources) > 0
|
| 267 |
|
| 268 |
# Cleanup
|
|
|
|
| 260 |
or "neural" in output_lower
|
| 261 |
or "learning" in output_lower
|
| 262 |
)
|
| 263 |
+
assert has_relevant_content, (
|
| 264 |
+
f"Output should contain relevant content, got: {result.output[:200]}"
|
| 265 |
+
)
|
| 266 |
assert len(result.sources) > 0
|
| 267 |
|
| 268 |
# Cleanup
|
tests/unit/orchestrator/test_graph_orchestrator.py
CHANGED
|
@@ -245,9 +245,9 @@ class TestGraphOrchestrator:
|
|
| 245 |
break
|
| 246 |
|
| 247 |
error_events = [e for e in events if e.type == "error"]
|
| 248 |
-
assert (
|
| 249 |
-
|
| 250 |
-
)
|
| 251 |
assert (
|
| 252 |
"error" in error_events[0].message.lower()
|
| 253 |
or "failed" in error_events[0].message.lower()
|
|
|
|
| 245 |
break
|
| 246 |
|
| 247 |
error_events = [e for e in events if e.type == "error"]
|
| 248 |
+
assert len(error_events) > 0, (
|
| 249 |
+
f"No error events found. Events: {[e.type for e in events]}"
|
| 250 |
+
)
|
| 251 |
assert (
|
| 252 |
"error" in error_events[0].message.lower()
|
| 253 |
or "failed" in error_events[0].message.lower()
|
tests/unit/tools/test_pubmed.py
CHANGED
|
@@ -173,9 +173,9 @@ class TestPubMedTool:
|
|
| 173 |
await tool.search("test query 4")
|
| 174 |
# Rate limiter uses polling with 0.01s sleep, so sleep should be called
|
| 175 |
# multiple times until enough time has passed (at least once)
|
| 176 |
-
assert (
|
| 177 |
-
mock_sleep.call_count
|
| 178 |
-
)
|
| 179 |
|
| 180 |
@pytest.mark.asyncio
|
| 181 |
async def test_api_key_included_in_params(self, mocker):
|
|
|
|
| 173 |
await tool.search("test query 4")
|
| 174 |
# Rate limiter uses polling with 0.01s sleep, so sleep should be called
|
| 175 |
# multiple times until enough time has passed (at least once)
|
| 176 |
+
assert mock_sleep.call_count > 0, (
|
| 177 |
+
f"Rate limiter should call sleep when rate limit is hit. Call count: {mock_sleep.call_count}"
|
| 178 |
+
)
|
| 179 |
|
| 180 |
@pytest.mark.asyncio
|
| 181 |
async def test_api_key_included_in_params(self, mocker):
|