Skip to content

Commit

Permalink
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Jan 20, 2025
1 parent 7ee0672 commit 96b1b21
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 34 deletions.
6 changes: 2 additions & 4 deletions sqlmodel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,15 @@ def __init__(self, default: Any = Undefined, **kwargs: Any) -> None:
)
if primary_key is not Undefined:
raise RuntimeError(
"Passing primary_key is not supported when "
"also passing a sa_column"
"Passing primary_key is not supported when also passing a sa_column"
)
if nullable is not Undefined:
raise RuntimeError(
"Passing nullable is not supported when also passing a sa_column"
)
if foreign_key is not Undefined:
raise RuntimeError(
"Passing foreign_key is not supported when "
"also passing a sa_column"
"Passing foreign_key is not supported when also passing a sa_column"
)
if ondelete is not Undefined:
raise RuntimeError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ def test_tutorial(clear_sqlmodel):
data = response.json()
assert response.status_code == 200, response.text
assert data["name"] == hero2_data["name"], "The name should not be set to none"
assert (
data["secret_name"] == "Spider-Youngster"
), "The secret name should be updated"
assert data["secret_name"] == "Spider-Youngster", (
"The secret name should be updated"
)

response = client.patch(f"/heroes/{hero3_id}", json={"age": None})
data = response.json()
assert response.status_code == 200, response.text
assert data["name"] == hero3_data["name"]
assert data["age"] is None, (
"A field should be updatable to None, even if " "that's the default"
"A field should be updatable to None, even if that's the default"
)

response = client.patch("/heroes/9001", json={"name": "Dragon Cube X"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ def test_tutorial(clear_sqlmodel):
data = response.json()
assert response.status_code == 200, response.text
assert data["name"] == hero2_data["name"], "The name should not be set to none"
assert (
data["secret_name"] == "Spider-Youngster"
), "The secret name should be updated"
assert data["secret_name"] == "Spider-Youngster", (
"The secret name should be updated"
)

response = client.patch(f"/heroes/{hero3_id}", json={"age": None})
data = response.json()
assert response.status_code == 200, response.text
assert data["name"] == hero3_data["name"]
assert data["age"] is None, (
"A field should be updatable to None, even if " "that's the default"
"A field should be updatable to None, even if that's the default"
)

response = client.patch("/heroes/9001", json={"name": "Dragon Cube X"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ def test_tutorial(clear_sqlmodel):
data = response.json()
assert response.status_code == 200, response.text
assert data["name"] == hero2_data["name"], "The name should not be set to none"
assert (
data["secret_name"] == "Spider-Youngster"
), "The secret name should be updated"
assert data["secret_name"] == "Spider-Youngster", (
"The secret name should be updated"
)

response = client.patch(f"/heroes/{hero3_id}", json={"age": None})
data = response.json()
assert response.status_code == 200, response.text
assert data["name"] == hero3_data["name"]
assert data["age"] is None, (
"A field should be updatable to None, even if " "that's the default"
"A field should be updatable to None, even if that's the default"
)

response = client.patch("/heroes/9001", json={"name": "Dragon Cube X"})
Expand Down
12 changes: 6 additions & 6 deletions tests/test_tutorial/test_fastapi/test_update/test_tutorial002.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def test_tutorial(clear_sqlmodel):
data = response.json()
assert response.status_code == 200, response.text
assert data["name"] == hero2_data["name"], "The name should not be set to none"
assert (
data["secret_name"] == "Spider-Youngster"
), "The secret name should be updated"
assert data["secret_name"] == "Spider-Youngster", (
"The secret name should be updated"
)
assert "password" not in data
assert "hashed_password" not in data
with Session(mod.engine) as session:
Expand All @@ -95,9 +95,9 @@ def test_tutorial(clear_sqlmodel):
data = response.json()
assert response.status_code == 200, response.text
assert data["name"] == hero3_data["name"]
assert (
data["age"] is None
), "A field should be updatable to None, even if that's the default"
assert data["age"] is None, (
"A field should be updatable to None, even if that's the default"
)
assert "password" not in data
assert "hashed_password" not in data
with Session(mod.engine) as session:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def test_tutorial(clear_sqlmodel):
data = response.json()
assert response.status_code == 200, response.text
assert data["name"] == hero2_data["name"], "The name should not be set to none"
assert (
data["secret_name"] == "Spider-Youngster"
), "The secret name should be updated"
assert data["secret_name"] == "Spider-Youngster", (
"The secret name should be updated"
)
assert "password" not in data
assert "hashed_password" not in data
with Session(mod.engine) as session:
Expand All @@ -98,9 +98,9 @@ def test_tutorial(clear_sqlmodel):
data = response.json()
assert response.status_code == 200, response.text
assert data["name"] == hero3_data["name"]
assert (
data["age"] is None
), "A field should be updatable to None, even if that's the default"
assert data["age"] is None, (
"A field should be updatable to None, even if that's the default"
)
assert "password" not in data
assert "hashed_password" not in data
with Session(mod.engine) as session:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def test_tutorial(clear_sqlmodel):
data = response.json()
assert response.status_code == 200, response.text
assert data["name"] == hero2_data["name"], "The name should not be set to none"
assert (
data["secret_name"] == "Spider-Youngster"
), "The secret name should be updated"
assert data["secret_name"] == "Spider-Youngster", (
"The secret name should be updated"
)
assert "password" not in data
assert "hashed_password" not in data
with Session(mod.engine) as session:
Expand All @@ -98,9 +98,9 @@ def test_tutorial(clear_sqlmodel):
data = response.json()
assert response.status_code == 200, response.text
assert data["name"] == hero3_data["name"]
assert (
data["age"] is None
), "A field should be updatable to None, even if that's the default"
assert data["age"] is None, (
"A field should be updatable to None, even if that's the default"
)
assert "password" not in data
assert "hashed_password" not in data
with Session(mod.engine) as session:
Expand Down

0 comments on commit 96b1b21

Please sign in to comment.