Skip to content

Commit

Permalink
flake8: f-string is missing placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
RezenkovD committed Sep 6, 2023
1 parent c1c7a6e commit b5c5327
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/routers/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async def auth(*, db: Session = Depends(get_db), request: Request):
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while create category",
detail="An error occurred while create category",
)
return RedirectResponse(url="https://" + settings.DOMAIN_NAME)

Expand Down
4 changes: 2 additions & 2 deletions src/services/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def create_category(
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while create category",
detail="An error occurred while create category",
)
else:
return db_category
Expand Down Expand Up @@ -104,7 +104,7 @@ def update_category(
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while update category",
detail="An error occurred while update category",
)
else:
return db_category_group
6 changes: 3 additions & 3 deletions src/services/expense.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def create_expense(
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while create expense",
detail="An error occurred while create expense",
)
else:
return db_expense
Expand All @@ -92,7 +92,7 @@ def update_expense(
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while update expense",
detail="An error occurred while update expense",
)
else:
return db_expense
Expand All @@ -108,7 +108,7 @@ def delete_expense(db: Session, user_id: int, group_id: int, expense_id: int) ->
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while delete expense",
detail="An error occurred while delete expense",
)


Expand Down
12 changes: 6 additions & 6 deletions src/services/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def remove_user(
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while disband group",
detail="An error occurred while disband group",
)
else:
return db_users_group
Expand All @@ -158,7 +158,7 @@ def remove_user(
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while remove user",
detail="An error occurred while remove user",
)
else:
return db_user_group
Expand Down Expand Up @@ -192,7 +192,7 @@ def leave_group(
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while leave group",
detail="An error occurred while leave group",
)
else:
return db_users_group
Expand All @@ -216,7 +216,7 @@ def leave_group(
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while leave group",
detail="An error occurred while leave group",
)
else:
return db_user_group
Expand All @@ -236,7 +236,7 @@ def create_group(db: Session, user_id: int, group: GroupCreate) -> GroupModel:
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while create group",
detail="An error occurred while create group",
)
else:
return db_group
Expand All @@ -259,7 +259,7 @@ def update_group(
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while update group",
detail="An error occurred while update group",
)
else:
return db_group
Expand Down
6 changes: 3 additions & 3 deletions src/services/invitation.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ def response_invitation(
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while add user in group",
detail="An error occurred while add user in group",
)
try:
db.commit()
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while response invitation",
detail="An error occurred while response invitation",
)
else:
return db_invitation
Expand Down Expand Up @@ -151,7 +151,7 @@ def create_invitation(
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while create invitation",
detail="An error occurred while create invitation",
)
else:
return db_invitation
6 changes: 3 additions & 3 deletions src/services/replenishment.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def create_replenishment(
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while create replenishments",
detail="An error occurred while create replenishments",
)
else:
return db_replenishment
Expand All @@ -49,7 +49,7 @@ def update_replenishment(
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while update replenishment",
detail="An error occurred while update replenishment",
)
else:
return db_replenishment
Expand All @@ -69,7 +69,7 @@ def delete_replenishment(db: Session, user_id: int, replenishment_id: int):
except:
raise HTTPException(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
detail=f"An error occurred while delete replenishment",
detail="An error occurred while delete replenishment",
)


Expand Down
2 changes: 1 addition & 1 deletion tests/test_endpoints/test_category_e.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_read_categories_group(self) -> None:
assert data.json() == categories_group_data

def test_read_categories_group_as_non_user_group(self) -> None:
data = client.get(f"/groups/9999/categories/")
data = client.get("/groups/9999/categories/")
assert data.status_code == 405

def test_create_category(self) -> None:
Expand Down
16 changes: 8 additions & 8 deletions tests/test_endpoints/test_expense_e.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def test_delete_expense(self) -> None:
)
data = client.delete(f"/groups/{self.first_group.id}/expenses/{expense.id}/")
assert data.status_code == 204
data = client.get(f"/groups/expenses/")
data = client.get("/groups/expenses/")
assert data.status_code == 200
expenses_data = []
response_data = {
Expand Down Expand Up @@ -359,7 +359,7 @@ def test_read_expenses_all_time(self) -> None:
group_id=self.second_group.id,
category_id=self.category.id,
)
data = client.get(f"/groups/expenses/")
data = client.get("/groups/expenses/")
assert data.status_code == 200
expenses_data = [
{
Expand Down Expand Up @@ -405,12 +405,12 @@ def test_read_expenses_all_time(self) -> None:
assert data.json() == response_data

def test_read_expenses_month_exc(self) -> None:
data = client.get(f"/groups/expenses/", params={"year_month": "11-2022"})
data = client.get("/groups/expenses/", params={"year_month": "11-2022"})
assert data.status_code == 422

def test_read_expenses_month(self) -> None:
time = datetime.datetime(2022, 12, 1)
data = client.get(f"/groups/expenses/", params={"year_month": "2022-12"})
data = client.get("/groups/expenses/", params={"year_month": "2022-12"})
assert data.json() == {
"items": [],
"total": 0,
Expand Down Expand Up @@ -440,7 +440,7 @@ def test_read_expenses_month(self) -> None:
time=time,
)

data = client.get(f"/groups/expenses/", params={"year_month": "2022-12"})
data = client.get("/groups/expenses/", params={"year_month": "2022-12"})

expenses_data = [
{
Expand Down Expand Up @@ -491,7 +491,7 @@ def test_read_expenses_month(self) -> None:
def test_read_expenses_time_range(self):
time = datetime.datetime(2022, 12, 1)
data = client.get(
f"/groups/expenses/",
"/groups/expenses/",
params={"start_date": "2022-12-1", "end_date": "2022-12-12"},
)
assert data.json() == {
Expand Down Expand Up @@ -524,7 +524,7 @@ def test_read_expenses_time_range(self):
)

data = client.get(
f"/groups/expenses/",
"/groups/expenses/",
params={"start_date": "2022-12-1", "end_date": "2022-12-12"},
)
expenses_data = [
Expand Down Expand Up @@ -575,7 +575,7 @@ def test_read_expenses_time_range(self):

def test_read_expenses_time_range_date_exc(self):
data = client.get(
f"/groups/expenses/",
"/groups/expenses/",
params={"start_date": "2022-12-31", "end_date": "2022-12-09"},
)
assert data.status_code == 404
4 changes: 2 additions & 2 deletions tests/test_endpoints/test_group_e.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def test_update_group_as_non_admin(self) -> None:
title="string", description="string", icon_url="string", color_code="string"
)
data = client.put(
f"/groups/9999",
"/groups/9999",
json={
"title": group.title,
"description": group.description,
Expand Down Expand Up @@ -192,7 +192,7 @@ def test_leave_group_user(self) -> None:
assert data == user_group_data

def test_leave_group_not_found(self) -> None:
data = client.post(f"/groups/9999/leave/")
data = client.post("/groups/9999/leave/")
assert data.status_code == 404

def test_leave_group_admin(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_endpoints/test_invitation_e.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def test_response_invitation(self) -> None:
def test_response_invitation_not_found(self) -> None:
response = UserResponseEnum.ACCEPTED
data = client.post(
f"invitations/9999/response/",
"invitations/9999/response/",
params={"invitation_id": 9999, "response": response},
)
assert data.status_code == 404
Expand Down
12 changes: 6 additions & 6 deletions tests/test_endpoints/test_replenishment_e.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_delete_replenishment(self) -> None:
replenishment = ReplenishmentFactory(user_id=self.user.id)
data = client.delete(f"/replenishments/{replenishment.id}/")
assert data.status_code == 204
data = client.get(f"/replenishments/")
data = client.get("/replenishments/")
assert data.status_code == 200
replenishments_data = []
response_data = {
Expand All @@ -84,7 +84,7 @@ def test_delete_replenishment(self) -> None:
def test_read_replenishments_all_time(self) -> None:
first_replenishments = ReplenishmentFactory(user_id=self.user.id)
second_replenishments = ReplenishmentFactory(user_id=self.user.id)
data = client.get(f"/replenishments/")
data = client.get("/replenishments/")
assert data.status_code == 200
replenishments_data = [
{
Expand Down Expand Up @@ -115,17 +115,17 @@ def test_read_replenishments_exc_three_args(self) -> None:
"end_date": "2022-12-12",
"year_month": "2022-12",
}
data = client.get(f"/replenishments/", params=params)
data = client.get("/replenishments/", params=params)
assert data.status_code == 422

def test_read_replenishments_exc_args_no_match(self) -> None:
params = {"end_date": "2022-12-12", "year_month": "2022-12"}
data = client.get(f"/replenishments/", params=params)
data = client.get("/replenishments/", params=params)
assert data.status_code == 422

def test_read_replenishments_month_exc(self) -> None:
params = {"year_month": "12-2022"}
data = client.get(f"/replenishments/", params=params)
data = client.get("/replenishments/", params=params)
assert data.status_code == 422

def test_read_replenishments_month(self) -> None:
Expand Down Expand Up @@ -213,5 +213,5 @@ def test_read_replenishments_time_range(self) -> None:

def test_read_replenishments_time_range_date_exc(self) -> None:
params = {"start_date": "2022-12-31", "end_date": "2022-12-09"}
data = client.get(f"/replenishments/", params=params)
data = client.get("/replenishments/", params=params)
assert data.status_code == 404

0 comments on commit b5c5327

Please sign in to comment.