Skip to content

Commit 125927c

Browse files
style: apply ruff format to tests/test_cli.py
1 parent 1d1c9e1 commit 125927c

1 file changed

Lines changed: 24 additions & 6 deletions

File tree

tests/test_cli.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ def test_convert_output_file(self, tmp_path):
5959
json_file.write_text(json.dumps({"name": "test"}))
6060
out_file = tmp_path / "out.sql"
6161

62-
result = runner.invoke(app, ["convert", str(json_file), "--output", str(out_file)])
62+
result = runner.invoke(
63+
app, ["convert", str(json_file), "--output", str(out_file)]
64+
)
6365
assert result.exit_code == 0
6466
assert out_file.exists()
6567
content = out_file.read_text()
@@ -117,14 +119,18 @@ def test_convert_schema_only_with_flatten(self, tmp_path):
117119
json_file = tmp_path / "nested.json"
118120
json_file.write_text(json.dumps(data))
119121

120-
result = runner.invoke(app, ["convert", str(json_file), "--schema-only", "--flatten"])
122+
result = runner.invoke(
123+
app, ["convert", str(json_file), "--schema-only", "--flatten"]
124+
)
121125
assert result.exit_code == 0
122126
assert "CREATE TABLE" in result.stdout
123127
assert "INSERT INTO" not in result.stdout
124128

125129
def test_convert_stdin(self):
126130
"""Read JSON from stdin."""
127-
result = runner.invoke(app, ["convert"], input=json.dumps({"name": "stdin_test"}))
131+
result = runner.invoke(
132+
app, ["convert"], input=json.dumps({"name": "stdin_test"})
133+
)
128134
assert result.exit_code == 0
129135
assert "'stdin_test'" in result.stdout
130136

@@ -186,6 +192,7 @@ def test_mcp_import_error_handled_gracefully(self):
186192
import builtins
187193
import sys
188194
import unittest.mock as mock
195+
189196
# Remove click_to_mcp from cache so the import statement is executed
190197
old_mod = sys.modules.pop("click_to_mcp", None)
191198

@@ -210,7 +217,11 @@ def test_mcp_command_exists(self):
210217
"""mcp command is registered and responds to --help."""
211218
result = runner.invoke(app, ["mcp", "--help"])
212219
assert result.exit_code == 0
213-
assert "MCP" in result.stdout or "Model Context" in result.stdout or "stdio" in result.stdout
220+
assert (
221+
"MCP" in result.stdout
222+
or "Model Context" in result.stdout
223+
or "stdio" in result.stdout
224+
)
214225

215226

216227
class TestCLIErrorHandling:
@@ -220,7 +231,12 @@ def test_no_args_shows_help(self):
220231
"""Running without args shows help."""
221232
result = runner.invoke(app)
222233
# Typer with no_args_is_help may exit 0 or 2 depending on version
223-
assert "Usage:" in result.stdout or "Usage:" in result.stderr or "Convert" in result.stdout or "Convert" in result.stderr
234+
assert (
235+
"Usage:" in result.stdout
236+
or "Usage:" in result.stderr
237+
or "Convert" in result.stdout
238+
or "Convert" in result.stderr
239+
)
224240

225241
def test_convert_array_of_objects(self, tmp_path):
226242
"""Convert array of objects via CLI."""
@@ -249,7 +265,9 @@ def test_convert_boolean_values(self, tmp_path):
249265
json_file.write_text(json.dumps(data))
250266

251267
# Postgres
252-
result = runner.invoke(app, ["convert", str(json_file), "--dialect", "postgres"])
268+
result = runner.invoke(
269+
app, ["convert", str(json_file), "--dialect", "postgres"]
270+
)
253271
assert result.exit_code == 0
254272
assert "TRUE" in result.stdout
255273
assert "FALSE" in result.stdout

0 commit comments

Comments
 (0)