mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-05 21:45:25 +02:00
chore(deps): update dependency ruff to ^0.9.0 (#4871)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com> Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
parent
ea0bec2336
commit
2c2de1e95b
22 changed files with 124 additions and 138 deletions
|
@ -1,7 +1,7 @@
|
|||
import random
|
||||
import time
|
||||
from collections import defaultdict
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from datetime import UTC, datetime, timedelta
|
||||
from random import randint
|
||||
from urllib.parse import parse_qsl, urlsplit
|
||||
|
||||
|
@ -238,7 +238,7 @@ def test_pagination_filter_null(unique_user: TestUser):
|
|||
user_id=unique_user.user_id,
|
||||
group_id=unique_user.group_id,
|
||||
name=random_string(),
|
||||
last_made=datetime.now(timezone.utc),
|
||||
last_made=datetime.now(UTC),
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -626,7 +626,7 @@ def test_pagination_filter_datetimes(
|
|||
)
|
||||
def test_pagination_order_by_multiple(unique_user: TestUser, order_direction: OrderDirection):
|
||||
database = unique_user.repos
|
||||
current_time = datetime.now(timezone.utc)
|
||||
current_time = datetime.now(UTC)
|
||||
|
||||
alphabet = ["a", "b", "c", "d", "e"]
|
||||
abbreviations = alphabet.copy()
|
||||
|
@ -687,7 +687,7 @@ def test_pagination_order_by_multiple_directions(
|
|||
unique_user: TestUser, order_by_str: str, order_direction: OrderDirection
|
||||
):
|
||||
database = unique_user.repos
|
||||
current_time = datetime.now(timezone.utc)
|
||||
current_time = datetime.now(UTC)
|
||||
|
||||
alphabet = ["a", "b", "c", "d", "e"]
|
||||
abbreviations = alphabet.copy()
|
||||
|
@ -735,7 +735,7 @@ def test_pagination_order_by_multiple_directions(
|
|||
)
|
||||
def test_pagination_order_by_nested_model(unique_user: TestUser, order_direction: OrderDirection):
|
||||
database = unique_user.repos
|
||||
current_time = datetime.now(timezone.utc)
|
||||
current_time = datetime.now(UTC)
|
||||
|
||||
alphabet = ["a", "b", "c", "d", "e"]
|
||||
labels = database.group_multi_purpose_labels.create_many(
|
||||
|
@ -766,7 +766,7 @@ def test_pagination_order_by_nested_model(unique_user: TestUser, order_direction
|
|||
|
||||
def test_pagination_order_by_doesnt_filter(unique_user: TestUser):
|
||||
database = unique_user.repos
|
||||
current_time = datetime.now(timezone.utc)
|
||||
current_time = datetime.now(UTC)
|
||||
|
||||
label = database.group_multi_purpose_labels.create(
|
||||
MultiPurposeLabelSave(name=random_string(), group_id=unique_user.group_id)
|
||||
|
@ -810,7 +810,7 @@ def test_pagination_order_by_nulls(
|
|||
unique_user: TestUser, null_position: OrderByNullPosition, order_direction: OrderDirection
|
||||
):
|
||||
database = unique_user.repos
|
||||
current_time = datetime.now(timezone.utc)
|
||||
current_time = datetime.now(UTC)
|
||||
|
||||
label = database.group_multi_purpose_labels.create(
|
||||
MultiPurposeLabelSave(name=random_string(), group_id=unique_user.group_id)
|
||||
|
@ -916,7 +916,7 @@ def test_pagination_shopping_list_items_with_labels(unique_user: TestUser):
|
|||
|
||||
|
||||
def test_pagination_filter_dates(api_client: TestClient, unique_user: TestUser):
|
||||
today = datetime.now(timezone.utc).date()
|
||||
today = datetime.now(UTC).date()
|
||||
|
||||
yesterday = today - timedelta(days=1)
|
||||
tomorrow = today + timedelta(days=1)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from datetime import datetime, timezone
|
||||
from datetime import UTC, datetime
|
||||
from typing import cast
|
||||
from uuid import UUID
|
||||
|
||||
|
@ -340,12 +340,12 @@ def test_recipe_repo_pagination_by_categories(unique_user: TestUser):
|
|||
page=1,
|
||||
per_page=-1,
|
||||
order_by="random",
|
||||
pagination_seed=str(datetime.now(timezone.utc)),
|
||||
pagination_seed=str(datetime.now(UTC)),
|
||||
order_direction=OrderDirection.asc,
|
||||
)
|
||||
random_ordered = []
|
||||
for _ in range(5):
|
||||
pagination_query.pagination_seed = str(datetime.now(timezone.utc))
|
||||
pagination_query.pagination_seed = str(datetime.now(UTC))
|
||||
random_ordered.append(database.recipes.page_all(pagination_query, categories=[category_slug]).items)
|
||||
assert not all(i == random_ordered[0] for i in random_ordered)
|
||||
|
||||
|
@ -437,12 +437,12 @@ def test_recipe_repo_pagination_by_tags(unique_user: TestUser):
|
|||
page=1,
|
||||
per_page=-1,
|
||||
order_by="random",
|
||||
pagination_seed=str(datetime.now(timezone.utc)),
|
||||
pagination_seed=str(datetime.now(UTC)),
|
||||
order_direction=OrderDirection.asc,
|
||||
)
|
||||
random_ordered = []
|
||||
for _ in range(5):
|
||||
pagination_query.pagination_seed = str(datetime.now(timezone.utc))
|
||||
pagination_query.pagination_seed = str(datetime.now(UTC))
|
||||
random_ordered.append(database.recipes.page_all(pagination_query, tags=[tag_slug]).items)
|
||||
assert len(random_ordered[0]) == 15
|
||||
assert not all(i == random_ordered[0] for i in random_ordered)
|
||||
|
@ -534,12 +534,12 @@ def test_recipe_repo_pagination_by_tools(unique_user: TestUser):
|
|||
page=1,
|
||||
per_page=-1,
|
||||
order_by="random",
|
||||
pagination_seed=str(datetime.now(timezone.utc)),
|
||||
pagination_seed=str(datetime.now(UTC)),
|
||||
order_direction=OrderDirection.asc,
|
||||
)
|
||||
random_ordered = []
|
||||
for _ in range(5):
|
||||
pagination_query.pagination_seed = str(datetime.now(timezone.utc))
|
||||
pagination_query.pagination_seed = str(datetime.now(UTC))
|
||||
random_ordered.append(database.recipes.page_all(pagination_query, tools=[tool_id]).items)
|
||||
assert len(random_ordered[0]) == 15
|
||||
assert not all(i == random_ordered[0] for i in random_ordered)
|
||||
|
@ -619,12 +619,12 @@ def test_recipe_repo_pagination_by_foods(unique_user: TestUser):
|
|||
page=1,
|
||||
per_page=-1,
|
||||
order_by="random",
|
||||
pagination_seed=str(datetime.now(timezone.utc)),
|
||||
pagination_seed=str(datetime.now(UTC)),
|
||||
order_direction=OrderDirection.asc,
|
||||
)
|
||||
random_ordered = []
|
||||
for _ in range(5):
|
||||
pagination_query.pagination_seed = str(datetime.now(timezone.utc))
|
||||
pagination_query.pagination_seed = str(datetime.now(UTC))
|
||||
random_ordered.append(database.recipes.page_all(pagination_query, foods=[food_id]).items)
|
||||
assert len(random_ordered[0]) == 15
|
||||
assert not all(i == random_ordered[0] for i in random_ordered)
|
||||
|
@ -696,12 +696,12 @@ def test_random_order_recipe_search(
|
|||
page=1,
|
||||
per_page=-1,
|
||||
order_by="random",
|
||||
pagination_seed=str(datetime.now(timezone.utc)),
|
||||
pagination_seed=str(datetime.now(UTC)),
|
||||
order_direction=OrderDirection.asc,
|
||||
)
|
||||
random_ordered = []
|
||||
for _ in range(5):
|
||||
pagination.pagination_seed = str(datetime.now(timezone.utc))
|
||||
pagination.pagination_seed = str(datetime.now(UTC))
|
||||
random_ordered.append(repo.page_all(pagination, search="soup").items)
|
||||
assert not all(i == random_ordered[0] for i in random_ordered)
|
||||
|
||||
|
@ -713,7 +713,7 @@ def test_order_by_rating(user_tuple: tuple[TestUser, TestUser]):
|
|||
|
||||
recipes: list[Recipe] = []
|
||||
for i in range(3):
|
||||
slug = f"recipe-{i+1}-{random_string(5)}"
|
||||
slug = f"recipe-{i + 1}-{random_string(5)}"
|
||||
recipes.append(
|
||||
repo.create(
|
||||
Recipe(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from datetime import datetime, timezone
|
||||
from datetime import UTC, datetime
|
||||
|
||||
import pytest
|
||||
from sqlalchemy.orm import Session
|
||||
|
@ -129,11 +129,11 @@ def test_random_order_search(
|
|||
page=1,
|
||||
per_page=-1,
|
||||
order_by="random",
|
||||
pagination_seed=str(datetime.now(timezone.utc)),
|
||||
pagination_seed=str(datetime.now(UTC)),
|
||||
order_direction=OrderDirection.asc,
|
||||
)
|
||||
random_ordered = []
|
||||
for _ in range(5):
|
||||
pagination.pagination_seed = str(datetime.now(timezone.utc))
|
||||
pagination.pagination_seed = str(datetime.now(UTC))
|
||||
random_ordered.append(repo.page_all(pagination, search="unit").items)
|
||||
assert not all(i == random_ordered[0] for i in random_ordered)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue