diff --git a/agave/core/filters.py b/agave/core/filters.py index 5ca476c..f2d1066 100644 --- a/agave/core/filters.py +++ b/agave/core/filters.py @@ -1,10 +1,8 @@ -from typing import List - from cuenca_validations.types import QueryParams from mongoengine import Q -def generic_query(query: QueryParams, excluded: List[str] = []) -> Q: +def generic_query(query: QueryParams, excluded: list[str] = []) -> Q: filters = Q() if query.created_before: filters &= Q(created_at__lt=query.created_before) diff --git a/tests/chalice_tests/blueprint/test_blueprint.py b/tests/chalice_tests/blueprint/test_blueprint.py index 6be08b8..c4d99d1 100644 --- a/tests/chalice_tests/blueprint/test_blueprint.py +++ b/tests/chalice_tests/blueprint/test_blueprint.py @@ -1,5 +1,4 @@ import datetime as dt -from typing import List from unittest.mock import MagicMock, patch from urllib.parse import urlencode @@ -143,7 +142,7 @@ def test_query_all_with_limit(client: Client) -> None: @pytest.mark.usefixtures('accounts') -def test_query_all_resource(client: Client, accounts: List[Account]) -> None: +def test_query_all_resource(client: Client, accounts: list[Account]) -> None: accounts = list(reversed(accounts)) items = [] @@ -160,7 +159,7 @@ def test_query_all_resource(client: Client, accounts: List[Account]) -> None: def test_query_all_filter_active( - client: Client, account: Account, accounts: List[Account] + client: Client, account: Account, accounts: list[Account] ) -> None: query_params = dict(active=True) # Query active items @@ -188,7 +187,7 @@ def test_query_all_filter_active( def test_query_all_created_after( - client: Client, accounts: List[Account] + client: Client, accounts: list[Account] ) -> None: created_at = dt.datetime(2020, 2, 1) expected_length = len([a for a in accounts if a.created_at > created_at]) @@ -202,7 +201,7 @@ def test_query_all_created_after( @patch(PLATFORM_ID_FILTER_REQUIRED, MagicMock(return_value=True)) def test_query_platform_id_filter_required( - client: Client, accounts: List[Account] + client: Client, accounts: list[Account] ) -> None: accounts = list( reversed( @@ -226,7 +225,7 @@ def test_query_platform_id_filter_required( @patch(USER_ID_FILTER_REQUIRED, MagicMock(return_value=True)) def test_query_user_id_filter_required( - client: Client, accounts: List[Account] + client: Client, accounts: list[Account] ) -> None: accounts = list( reversed([a for a in accounts if a.user_id == TEST_DEFAULT_USER_ID]) diff --git a/tests/chalice_tests/conftest.py b/tests/chalice_tests/conftest.py index e83e443..2701241 100644 --- a/tests/chalice_tests/conftest.py +++ b/tests/chalice_tests/conftest.py @@ -1,6 +1,6 @@ import datetime as dt import functools -from typing import Callable, Generator, List +from typing import Callable, Generator import pytest from chalice.test import Client @@ -22,7 +22,7 @@ def collection_fixture(model: Document) -> Callable[..., FuncDecorator]: def collection_decorator(func: Callable) -> FuncDecorator: @functools.wraps(func) - def wrapper(*args, **kwargs) -> Generator[List, None, None]: + def wrapper(*args, **kwargs) -> Generator[list, None, None]: items = func(*args, **kwargs) for item in items: item.save() @@ -54,7 +54,7 @@ def client() -> Generator[Client, None, None]: @pytest.fixture @collection_fixture(Account) -def accounts() -> List[Account]: +def accounts() -> list[Account]: return [ Account( name='Frida Kahlo', @@ -96,18 +96,18 @@ def accounts() -> List[Account]: @pytest.fixture -def account(accounts: List[Account]) -> Generator[Account, None, None]: +def account(accounts: list[Account]) -> Generator[Account, None, None]: yield accounts[0] @pytest.fixture -def other_account(accounts: List[Account]) -> Generator[Account, None, None]: +def other_account(accounts: list[Account]) -> Generator[Account, None, None]: yield accounts[-1] @pytest.fixture @collection_fixture(File) -def files() -> List[File]: +def files() -> list[File]: return [ File( name='Frida Kahlo', @@ -117,13 +117,13 @@ def files() -> List[File]: @pytest.fixture -def file(files: List[File]) -> Generator[File, None, None]: +def file(files: list[File]) -> Generator[File, None, None]: yield files[0] @pytest.fixture @collection_fixture(Card) -def cards() -> List[Card]: +def cards() -> list[Card]: return [ Card( number='5434000000000001', @@ -149,13 +149,13 @@ def cards() -> List[Card]: @pytest.fixture -def card(cards: List[Card]) -> Generator[Card, None, None]: +def card(cards: list[Card]) -> Generator[Card, None, None]: yield cards[0] @pytest.fixture @collection_fixture(User) -def users() -> List[User]: +def users() -> list[User]: return [ User(name='User1', platform_id=TEST_DEFAULT_PLATFORM_ID), User(name='User2', platform_id=TEST_SECOND_PLATFORM_ID), @@ -164,7 +164,7 @@ def users() -> List[User]: @pytest.fixture @collection_fixture(Biller) -def billers() -> List[Biller]: +def billers() -> list[Biller]: return [ Biller(name='Telcel'), Biller(name='ATT'), diff --git a/tests/fast_tests/blueprint/test_blueprint.py b/tests/fast_tests/blueprint/test_blueprint.py index c069744..f33f619 100644 --- a/tests/fast_tests/blueprint/test_blueprint.py +++ b/tests/fast_tests/blueprint/test_blueprint.py @@ -1,6 +1,5 @@ import datetime as dt from tempfile import TemporaryFile -from typing import List from unittest.mock import MagicMock, patch from urllib.parse import urlencode @@ -139,7 +138,7 @@ def test_query_all_with_limit(client: TestClient) -> None: def test_query_all_resource( - client: TestClient, accounts: List[Account] + client: TestClient, accounts: list[Account] ) -> None: accounts = list(reversed(accounts)) @@ -158,7 +157,7 @@ def test_query_all_resource( def test_query_all_created_after( - client: TestClient, accounts: List[Account] + client: TestClient, accounts: list[Account] ) -> None: created_at = dt.datetime(2020, 2, 1) expected_length = len([a for a in accounts if a.created_at > created_at]) @@ -173,7 +172,7 @@ def test_query_all_created_after( @patch(PLATFORM_ID_FILTER_REQUIRED, MagicMock(return_value=True)) def test_query_platform_id_filter_required( - client: TestClient, accounts: List[Account] + client: TestClient, accounts: list[Account] ) -> None: accounts = list( reversed( @@ -197,7 +196,7 @@ def test_query_platform_id_filter_required( @patch(USER_ID_FILTER_REQUIRED, MagicMock(return_value=True)) def test_query_user_id_filter_required( - client: TestClient, accounts: List[Account] + client: TestClient, accounts: list[Account] ) -> None: accounts = list( reversed([a for a in accounts if a.user_id == TEST_DEFAULT_USER_ID]) diff --git a/tests/fast_tests/conftest.py b/tests/fast_tests/conftest.py index 4c6fdf6..c29ed3f 100644 --- a/tests/fast_tests/conftest.py +++ b/tests/fast_tests/conftest.py @@ -2,7 +2,7 @@ import functools import os from functools import partial -from typing import Callable, Generator, List +from typing import Callable, Generator import aiobotocore import boto3 @@ -28,7 +28,7 @@ def collection_fixture(model: Document) -> Callable[..., FuncDecorator]: def collection_decorator(func: Callable) -> FuncDecorator: @functools.wraps(func) - def wrapper(*args, **kwargs) -> Generator[List, None, None]: + def wrapper(*args, **kwargs) -> Generator[list, None, None]: items = func(*args, **kwargs) for item in items: item.save() @@ -48,7 +48,7 @@ def client() -> Generator[TestClient, None, None]: @pytest.fixture @collection_fixture(Account) -def accounts() -> List[Account]: +def accounts() -> list[Account]: return [ Account( name='Frida Kahlo', @@ -90,23 +90,23 @@ def accounts() -> List[Account]: @pytest.fixture -def account(accounts: List[Account]) -> Generator[Account, None, None]: +def account(accounts: list[Account]) -> Generator[Account, None, None]: yield accounts[0] @pytest.fixture -def user(users: List[User]) -> Generator[User, None, None]: +def user(users: list[User]) -> Generator[User, None, None]: yield users[0] @pytest.fixture -def other_account(accounts: List[Account]) -> Generator[Account, None, None]: +def other_account(accounts: list[Account]) -> Generator[Account, None, None]: yield accounts[-1] @pytest.fixture @collection_fixture(File) -def files() -> List[File]: +def files() -> list[File]: return [ File( name='Frida Kahlo', @@ -116,13 +116,13 @@ def files() -> List[File]: @pytest.fixture -def file(files: List[File]) -> Generator[File, None, None]: +def file(files: list[File]) -> Generator[File, None, None]: yield files[0] @pytest.fixture @collection_fixture(Card) -def cards() -> List[Card]: +def cards() -> list[Card]: return [ Card( number='5434000000000001', @@ -148,13 +148,13 @@ def cards() -> List[Card]: @pytest.fixture -def card(cards: List[Card]) -> Generator[Card, None, None]: +def card(cards: list[Card]) -> Generator[Card, None, None]: yield cards[0] @pytest.fixture @collection_fixture(User) -def users() -> List[User]: +def users() -> list[User]: return [ User(name='User1', platform_id=TEST_DEFAULT_PLATFORM_ID), User(name='User2', platform_id=TEST_SECOND_PLATFORM_ID), @@ -163,7 +163,7 @@ def users() -> List[User]: @pytest.fixture @collection_fixture(Biller) -def billers() -> List[Biller]: +def billers() -> list[Biller]: return [ Biller(name='Telcel'), Biller(name='ATT'),