Skip to content

Commit

Permalink
formatting changes to suit ruff
Browse files Browse the repository at this point in the history
Signed-off-by: Grant Ramsay <seapagan@gmail.com>
  • Loading branch information
seapagan committed Jan 25, 2025
1 parent 17969d7 commit b82b33c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ repos:
- id: end-of-file-fixer

- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 39.84.0
rev: 39.133.3
hooks:
- id: renovate-config-validator
files: ^renovate\.json$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
rev: v0.9.3
hooks:
- id: ruff
name: "lint with ruff"
- id: ruff-format
name: "format with ruff"

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.14.0" # Use the sha / tag you want to point at
rev: "v1.14.1" # Use the sha / tag you want to point at
hooks:
- id: mypy
name: "run mypy"
Expand All @@ -35,7 +35,7 @@ repos:

- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.5.13
rev: 0.5.24
hooks:
# Update the uv lockfile
- id: uv-lock
Expand Down
6 changes: 3 additions & 3 deletions tests/test_context_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ def test_commit_called_once_in_transaction(self, mocker, tmp_path) -> None:

# Assert that the data was committed
assert result is not None, "Data was not committed."
assert (
result[3] == "test"
), f"Expected slug to be 'test', but got {result[3]}"
assert result[3] == "test", (
f"Expected slug to be 'test', but got {result[3]}"
)

# Close the new connection
new_conn.close()
12 changes: 6 additions & 6 deletions tests/test_debug_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ def test_sqliterdb_debug_default(self) -> None:
def test_sqliterdb_debug_set_false(self) -> None:
"""Test that the default value for the debug flag is False."""
db = SqliterDB(":memory:", debug=False) # Set debug argument to False
assert (
db.debug is False
), "The debug flag should be False when explicitly passed as False."
assert db.debug is False, (
"The debug flag should be False when explicitly passed as False."
)

def test_sqliterdb_debug_set_true(self) -> None:
"""Test that the debug flag can be set to True."""
db = SqliterDB(":memory:", debug=True) # Set debug argument to True
assert (
db.debug is True
), "The debug flag should be True when explicitly passed as True."
assert db.debug is True, (
"The debug flag should be True when explicitly passed as True."
)

def test_debug_sql_output_basic_query(
self, db_mock_complex_debug: SqliterDB, caplog
Expand Down
24 changes: 12 additions & 12 deletions tests/test_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def test_is_autocommit_property_true(self) -> None:
def test_is_autocommit_property_false(self) -> None:
"""Test 'is_autocommit' prop returns False when auto-commit disabled."""
db = SqliterDB(memory=True, auto_commit=False)
assert (
db.is_autocommit is False
), "Expected False for auto-commit disabled"
assert db.is_autocommit is False, (
"Expected False for auto-commit disabled"
)

def test_is_connected_property_when_connected(self) -> None:
"""Test the 'is_connected' property when the database is connected."""
Expand Down Expand Up @@ -71,9 +71,9 @@ class Meta:

# Verify that the table exists while the connection is still open
table_names = db.table_names
assert (
"test_table" in table_names
), f"Expected 'test_table', got {table_names}"
assert "test_table" in table_names, (
f"Expected 'test_table', got {table_names}"
)

# Explicitly close the connection afterwards
db.close()
Expand All @@ -94,9 +94,9 @@ class Meta:

# Check the table names while the connection is still open
table_names = db.table_names
assert (
"another_table" in table_names
), f"Expected 'another_table', got {table_names}"
assert "another_table" in table_names, (
f"Expected 'another_table', got {table_names}"
)

# Close the connection explicitly after the check
db.close()
Expand Down Expand Up @@ -127,9 +127,9 @@ class Meta:
# Ensure that accessing table_names does NOT raise an error Since
# it's file-based, the table should still exist after reconnecting
table_names = db.table_names
assert (
"test_table" in table_names
), f"Expected 'test_table', got {table_names}"
assert "test_table" in table_names, (
f"Expected 'test_table', got {table_names}"
)

def test_table_names_connection_failure(self, mocker) -> None:
"""Test 'table_names' raises exception if the connection fails."""
Expand Down
6 changes: 3 additions & 3 deletions tests/test_sqliter.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,9 @@ def test_complex_model_primary_key(self, db_mock) -> None:

# Assert that the primary key is the 'id' field and is an INTEGER
assert primary_key_column is not None, "Primary key not found"
assert (
primary_key_column[1] == "pk"
), f"Expected 'id' as primary key, but got {primary_key_column[1]}"
assert primary_key_column[1] == "pk", (
f"Expected 'id' as primary key, but got {primary_key_column[1]}"
)
assert primary_key_column[2] == "INTEGER", (
f"Expected 'INTEGER' type for primary key, but got "
f"{primary_key_column[2]}"
Expand Down

0 comments on commit b82b33c

Please sign in to comment.