Skip to content

Commit e158cc8

Browse files
fix(pre_commit): 🎨 auto format pre-commit hooks
1 parent 65628e3 commit e158cc8

6 files changed

Lines changed: 38 additions & 33 deletions

File tree

tests/cli/test_folder_handler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ class TestFolderCreateHandler(unittest.TestCase):
131131
@patch("roboflow.config.load_roboflow_api_key", return_value="fake-key")
132132
def test_create_folder_json(self, _mock_key, _mock_ws, mock_create):
133133
mock_create.return_value = {"id": "new-folder-id"}
134-
args = Namespace(json=True, workspace=None, api_key=None, quiet=False, name="NewFolder", parent=None, projects=None)
134+
args = Namespace(
135+
json=True, workspace=None, api_key=None, quiet=False, name="NewFolder", parent=None, projects=None
136+
)
135137

136138
from roboflow.cli.handlers.folder import _create_folder
137139

tests/cli/test_universe_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def test_search_passes_api_key(self) -> None:
7373

7474
parser = build_parser()
7575
args = parser.parse_args(["universe", "search", "cats"])
76-
from unittest.mock import call, patch
76+
from unittest.mock import patch
7777

7878
mock_data = {"results": []}
7979
captured = io.StringIO()

tests/cli/test_version_handler.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,7 @@ def test_create_invalid_json_file(self) -> None:
120120
f.write("not valid json")
121121
f.flush()
122122
parser = _make_parser()
123-
args = parser.parse_args(
124-
["--json", "version", "create", "-p", "my-ws/my-project", "--settings", f.name]
125-
)
123+
args = parser.parse_args(["--json", "version", "create", "-p", "my-ws/my-project", "--settings", f.name])
126124
args.api_key = "fake-key"
127125
with patch("roboflow.config.load_roboflow_api_key", return_value="fake-key"):
128126
with self.assertRaises(SystemExit) as ctx:
@@ -138,9 +136,7 @@ def test_create_no_api_key(self) -> None:
138136
json.dump(settings, f)
139137
f.flush()
140138
parser = _make_parser()
141-
args = parser.parse_args(
142-
["--json", "version", "create", "-p", "my-ws/my-project", "--settings", f.name]
143-
)
139+
args = parser.parse_args(["--json", "version", "create", "-p", "my-ws/my-project", "--settings", f.name])
144140
# Patch load_roboflow_api_key to return None
145141
from unittest.mock import patch
146142

tests/cli/test_video_handler.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ def test_status_json_output(self) -> None:
114114
result = json.loads(captured.getvalue())
115115
self.assertEqual(result["status"], "processing")
116116

117-
118117
def test_status_passes_job_id_to_api(self) -> None:
119118
import io
120119
import sys

tests/cli/test_workflow_handler.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import tempfile
66
import unittest
77
from argparse import Namespace
8-
from unittest.mock import MagicMock, patch
8+
from unittest.mock import patch
99

1010

1111
def _make_args(**kwargs):
@@ -97,9 +97,11 @@ class TestWorkflowList(unittest.TestCase):
9797
def test_list_workflows_text(self, _mock_key, mock_list):
9898
from roboflow.cli.handlers.workflow import _list_workflows
9999

100-
mock_list.return_value = {"workflows": [
101-
{"name": "My Workflow", "url": "my-workflow", "status": "active"},
102-
]}
100+
mock_list.return_value = {
101+
"workflows": [
102+
{"name": "My Workflow", "url": "my-workflow", "status": "active"},
103+
]
104+
}
103105
args = _make_args()
104106
with patch("builtins.print") as mock_print:
105107
_list_workflows(args)
@@ -112,9 +114,11 @@ def test_list_workflows_text(self, _mock_key, mock_list):
112114
def test_list_workflows_json(self, _mock_key, mock_list):
113115
from roboflow.cli.handlers.workflow import _list_workflows
114116

115-
mock_list.return_value = {"workflows": [
116-
{"name": "WF1", "url": "wf-1", "status": "active"},
117-
]}
117+
mock_list.return_value = {
118+
"workflows": [
119+
{"name": "WF1", "url": "wf-1", "status": "active"},
120+
]
121+
}
118122
args = _make_args(json=True)
119123
with patch("builtins.print") as mock_print:
120124
_list_workflows(args)
@@ -238,9 +242,7 @@ class TestWorkflowUpdate(unittest.TestCase):
238242
def test_update_workflow(self, _mock_key, mock_get, mock_update):
239243
from roboflow.cli.handlers.workflow import _update_workflow
240244

241-
mock_get.return_value = {
242-
"workflow": {"id": "wf-123", "name": "My WF", "url": "my-wf", "config": "{}"}
243-
}
245+
mock_get.return_value = {"workflow": {"id": "wf-123", "name": "My WF", "url": "my-wf", "config": "{}"}}
244246
mock_update.return_value = {"url": "my-wf", "status": "updated"}
245247
defn = {"blocks": []}
246248
with tempfile.NamedTemporaryFile(mode="w", suffix=".json", delete=False) as f:
@@ -304,10 +306,12 @@ class TestWorkflowVersionList(unittest.TestCase):
304306
def test_list_versions(self, _mock_key, mock_versions):
305307
from roboflow.cli.handlers.workflow import _list_workflow_versions
306308

307-
mock_versions.return_value = {"versions": [
308-
{"version": "1", "created": "2026-01-01"},
309-
{"version": "2", "created": "2026-02-01"},
310-
]}
309+
mock_versions.return_value = {
310+
"versions": [
311+
{"version": "1", "created": "2026-01-01"},
312+
{"version": "2", "created": "2026-02-01"},
313+
]
314+
}
311315
args = _make_args(workflow_url="my-wf")
312316
with patch("builtins.print") as mock_print:
313317
_list_workflow_versions(args)
@@ -340,9 +344,7 @@ def test_fork_workflow_same_workspace(self, _mock_key, mock_fork):
340344
args = _make_args(workflow_url="my-wf")
341345
with patch("builtins.print") as mock_print:
342346
_fork_workflow(args)
343-
mock_fork.assert_called_once_with(
344-
"test-key", "test-ws", source_workspace="test-ws", source_workflow="my-wf"
345-
)
347+
mock_fork.assert_called_once_with("test-key", "test-ws", source_workspace="test-ws", source_workflow="my-wf")
346348
printed = mock_print.call_args[0][0]
347349
self.assertIn("Forked workflow", printed)
348350

@@ -356,9 +358,7 @@ def test_fork_workflow_cross_workspace(self, _mock_key, mock_fork):
356358
args = _make_args(workflow_url="other-ws/my-wf")
357359
with patch("builtins.print"):
358360
_fork_workflow(args)
359-
mock_fork.assert_called_once_with(
360-
"test-key", "test-ws", source_workspace="other-ws", source_workflow="my-wf"
361-
)
361+
mock_fork.assert_called_once_with("test-key", "test-ws", source_workspace="other-ws", source_workflow="my-wf")
362362

363363
@patch("roboflow.adapters.rfapi.fork_workflow")
364364
@patch("roboflow.config.load_roboflow_api_key", return_value="test-key")

tests/cli/test_workspace.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ class TestWorkspaceStatsHandler(unittest.TestCase):
146146
@patch("roboflow.config.load_roboflow_api_key", return_value="fake-key")
147147
def test_stats_json(self, _mock_key, _mock_ws, mock_stats):
148148
mock_stats.return_value = {"stats": {"total_annotations": 500}}
149-
args = Namespace(json=True, workspace=None, api_key=None, quiet=False, start_date="2026-01-01", end_date="2026-04-01")
149+
args = Namespace(
150+
json=True, workspace=None, api_key=None, quiet=False, start_date="2026-01-01", end_date="2026-04-01"
151+
)
150152

151153
from roboflow.cli.handlers.workspace import _workspace_stats
152154

@@ -161,7 +163,9 @@ def test_stats_json(self, _mock_key, _mock_ws, mock_stats):
161163
@patch("roboflow.config.load_roboflow_api_key", return_value="fake-key")
162164
def test_stats_passes_dates(self, _mock_key, _mock_ws, mock_stats):
163165
mock_stats.return_value = {"stats": {"total_annotations": 500}}
164-
args = Namespace(json=True, workspace=None, api_key=None, quiet=False, start_date="2026-01-01", end_date="2026-04-01")
166+
args = Namespace(
167+
json=True, workspace=None, api_key=None, quiet=False, start_date="2026-01-01", end_date="2026-04-01"
168+
)
165169

166170
from roboflow.cli.handlers.workspace import _workspace_stats
167171

@@ -174,7 +178,9 @@ def test_stats_passes_dates(self, _mock_key, _mock_ws, mock_stats):
174178
@patch("roboflow.config.load_roboflow_api_key", return_value="fake-key")
175179
def test_stats_text(self, _mock_key, _mock_ws, mock_stats):
176180
mock_stats.return_value = {"stats": {"total_annotations": 500}}
177-
args = Namespace(json=False, workspace=None, api_key=None, quiet=False, start_date="2026-01-01", end_date="2026-04-01")
181+
args = Namespace(
182+
json=False, workspace=None, api_key=None, quiet=False, start_date="2026-01-01", end_date="2026-04-01"
183+
)
178184

179185
from roboflow.cli.handlers.workspace import _workspace_stats
180186

@@ -187,7 +193,9 @@ def test_stats_text(self, _mock_key, _mock_ws, mock_stats):
187193
@patch("roboflow.cli._resolver.resolve_default_workspace", return_value="test-ws")
188194
@patch("roboflow.config.load_roboflow_api_key", return_value="fake-key")
189195
def test_stats_error_json(self, _mock_key, _mock_ws, _mock_stats):
190-
args = Namespace(json=True, workspace=None, api_key=None, quiet=False, start_date="2026-01-01", end_date="2026-04-01")
196+
args = Namespace(
197+
json=True, workspace=None, api_key=None, quiet=False, start_date="2026-01-01", end_date="2026-04-01"
198+
)
191199

192200
from roboflow.cli.handlers.workspace import _workspace_stats
193201

0 commit comments

Comments
 (0)