diff options
| author | Max Nanis | 2026-03-09 06:27:14 -0400 |
|---|---|---|
| committer | Max Nanis | 2026-03-09 06:27:14 -0400 |
| commit | 2f92429a68ec7209059d2d18fe67964c8dd57cf2 (patch) | |
| tree | 641358598982860f6452d27a74cae809b0d2d430 /tests/incite | |
| parent | ce291a165fab6b6dc9f053c7b75a699d0fdf389f (diff) | |
| download | generalresearch-2f92429a68ec7209059d2d18fe67964c8dd57cf2.tar.gz generalresearch-2f92429a68ec7209059d2d18fe67964c8dd57cf2.zip | |
Simple typing changes, Ruff import formatter. p3
Diffstat (limited to 'tests/incite')
6 files changed, 207 insertions, 153 deletions
diff --git a/tests/incite/collections/test_df_collection_base.py b/tests/incite/collections/test_df_collection_base.py index 5aaa729..10f025b 100644 --- a/tests/incite/collections/test_df_collection_base.py +++ b/tests/incite/collections/test_df_collection_base.py @@ -1,15 +1,19 @@ from datetime import datetime, timezone +from typing import TYPE_CHECKING import pandas as pd import pytest from pandera import DataFrameSchema from generalresearch.incite.collections import ( - DFCollectionType, DFCollection, + DFCollectionType, ) from test_utils.incite.conftest import mnt_filepath +if TYPE_CHECKING: + from generalresearch.incite.base import GRLDatasets + df_collection_types = [e for e in DFCollectionType if e is not DFCollectionType.TEST] @@ -20,7 +24,7 @@ class TestDFCollectionBase: """ - def test_init(self, mnt_filepath, df_coll_type): + def test_init(self, mnt_filepath: "GRLDatasets", df_coll_type: DFCollectionType): """Try to initialize the DFCollection with various invalid parameters""" with pytest.raises(expected_exception=ValueError) as cm: DFCollection(archive_path=mnt_filepath.data_src) @@ -42,7 +46,7 @@ class TestDFCollectionBase: class TestDFCollectionBaseProperties: @pytest.mark.skip - def test_df_collection_items(self, mnt_filepath, df_coll_type): + def test_df_collection_items(self, mnt_filepath: "GRLDatasets", df_coll_type): instance = DFCollection( data_type=df_coll_type, start=datetime(year=1800, month=1, day=1, tzinfo=timezone.utc), @@ -54,7 +58,7 @@ class TestDFCollectionBaseProperties: assert len(instance.interval_range) == len(instance.items) assert len(instance.items) == 366 - def test_df_collection_progress(self, mnt_filepath, df_coll_type): + def test_df_collection_progress(self, mnt_filepath: "GRLDatasets", df_coll_type): instance = DFCollection( data_type=df_coll_type, start=datetime(year=1800, month=1, day=1, tzinfo=timezone.utc), @@ -67,7 +71,7 @@ class TestDFCollectionBaseProperties: assert isinstance(instance.progress, pd.DataFrame) assert instance.progress.shape == (366, 6) - def test_df_collection_schema(self, mnt_filepath, df_coll_type): + def test_df_collection_schema(self, mnt_filepath: "GRLDatasets", df_coll_type): instance1 = DFCollection( data_type=DFCollectionType.WALL, archive_path=mnt_filepath.data_src ) @@ -84,7 +88,7 @@ class TestDFCollectionBaseProperties: class TestDFCollectionBaseMethods: @pytest.mark.skip - def test_initial_load(self, mnt_filepath, thl_web_rr): + def test_initial_load(self, mnt_filepath: "GRLDatasets", thl_web_rr): instance = DFCollection( pg_config=thl_web_rr, data_type=DFCollectionType.USER, diff --git a/tests/incite/collections/test_df_collection_item_base.py b/tests/incite/collections/test_df_collection_item_base.py index a0c0b0b..136d234 100644 --- a/tests/incite/collections/test_df_collection_item_base.py +++ b/tests/incite/collections/test_df_collection_item_base.py @@ -1,13 +1,17 @@ from datetime import datetime, timezone +from typing import TYPE_CHECKING import pytest from generalresearch.incite.collections import ( - DFCollectionType, - DFCollectionItem, DFCollection, + DFCollectionItem, + DFCollectionType, ) -from test_utils.incite.conftest import mnt_filepath +from generalresearch.pg_helper import PostgresConfig + +if TYPE_CHECKING: + from generalresearch.incite.base import GRLDatasets df_collection_types = [e for e in DFCollectionType if e is not DFCollectionType.TEST] @@ -15,7 +19,7 @@ df_collection_types = [e for e in DFCollectionType if e is not DFCollectionType. @pytest.mark.parametrize("df_coll_type", df_collection_types) class TestDFCollectionItemBase: - def test_init(self, mnt_filepath, df_coll_type): + def test_init(self, mnt_filepath: "GRLDatasets", df_coll_type): collection = DFCollection( data_type=df_coll_type, offset="100d", @@ -41,7 +45,7 @@ class TestDFCollectionItemProperties: @pytest.mark.parametrize("df_coll_type", df_collection_types) class TestDFCollectionItemMethods: - def test_has_mysql_false(self, mnt_filepath, df_coll_type): + def test_has_mysql_false(self, mnt_filepath: "GRLDatasets", df_coll_type): collection = DFCollection( data_type=df_coll_type, offset="100d", @@ -53,7 +57,9 @@ class TestDFCollectionItemMethods: instance1: DFCollectionItem = collection.items[0] assert not instance1.has_mysql() - def test_has_mysql_true(self, thl_web_rr, mnt_filepath, df_coll_type): + def test_has_mysql_true( + self, thl_web_rr: PostgresConfig, mnt_filepath: "GRLDatasets", df_coll_type + ): collection = DFCollection( data_type=df_coll_type, offset="100d", diff --git a/tests/incite/collections/test_df_collection_item_thl_web.py b/tests/incite/collections/test_df_collection_item_thl_web.py index 9c3d67a..29f3677 100644 --- a/tests/incite/collections/test_df_collection_item_thl_web.py +++ b/tests/incite/collections/test_df_collection_item_thl_web.py @@ -1,7 +1,8 @@ -from datetime import datetime, timezone, timedelta +from datetime import datetime, timedelta, timezone from itertools import product as iter_product from os.path import join as pjoin -from pathlib import PurePath, Path +from pathlib import Path, PurePath +from typing import TYPE_CHECKING, Callable from uuid import uuid4 import dask.dataframe as dd @@ -11,13 +12,13 @@ from distributed import Client, Scheduler, Worker # noinspection PyUnresolvedReferences from distributed.utils_test import ( - gen_cluster, + cleanup, + client, client_no_amm, + cluster_fixture, + gen_cluster, loop, loop_in_thread, - cleanup, - cluster_fixture, - client, ) from faker import Faker from pandera import DataFrameSchema @@ -29,10 +30,14 @@ from generalresearch.incite.collections import ( DFCollectionType, ) from generalresearch.incite.schemas import ARCHIVE_AFTER +from generalresearch.models.thl.product import Product from generalresearch.models.thl.user import User from generalresearch.pg_helper import PostgresConfig from generalresearch.sql_helper import PostgresDsn -from test_utils.incite.conftest import mnt_filepath, incite_item_factory +from test_utils.incite.conftest import incite_item_factory, mnt_filepath + +if TYPE_CHECKING: + from generalresearch.incite.base import GRLDatasets fake = Faker() @@ -71,7 +76,7 @@ class TestDFCollectionItemBase: ) class TestDFCollectionItemProperties: - def test_filename(self, df_collection_data_type, df_collection, offset): + def test_filename(self, df_collection_data_type, df_collection, offset: str): for i in df_collection.items: assert isinstance(i.filename, str) @@ -88,35 +93,37 @@ class TestDFCollectionItemProperties: ) class TestDFCollectionItemPropertiesBase: - def test_name(self, df_collection_data_type, offset, df_collection): + def test_name(self, df_collection_data_type, offset: str, df_collection): for i in df_collection.items: assert isinstance(i.name, str) - def test_finish(self, df_collection_data_type, offset, df_collection): + def test_finish(self, df_collection_data_type, offset: str, df_collection): for i in df_collection.items: assert isinstance(i.finish, datetime) - def test_interval(self, df_collection_data_type, offset, df_collection): + def test_interval(self, df_collection_data_type, offset: str, df_collection): for i in df_collection.items: assert isinstance(i.interval, pd.Interval) - def test_partial_filename(self, df_collection_data_type, offset, df_collection): + def test_partial_filename( + self, df_collection_data_type, offset: str, df_collection + ): for i in df_collection.items: assert isinstance(i.partial_filename, str) - def test_empty_filename(self, df_collection_data_type, offset, df_collection): + def test_empty_filename(self, df_collection_data_type, offset: str, df_collection): for i in df_collection.items: assert isinstance(i.empty_filename, str) - def test_path(self, df_collection_data_type, offset, df_collection): + def test_path(self, df_collection_data_type, offset: str, df_collection): for i in df_collection.items: assert isinstance(i.path, FilePath) - def test_partial_path(self, df_collection_data_type, offset, df_collection): + def test_partial_path(self, df_collection_data_type, offset: str, df_collection): for i in df_collection.items: assert isinstance(i.partial_path, FilePath) - def test_empty_path(self, df_collection_data_type, offset, df_collection): + def test_empty_path(self, df_collection_data_type, offset: str, df_collection): for i in df_collection.items: assert isinstance(i.empty_path, FilePath) @@ -136,9 +143,9 @@ class TestDFCollectionItemMethod: def test_has_mysql( self, df_collection, - thl_web_rr, - offset, - duration, + thl_web_rr: PostgresConfig, + offset: str, + duration: timedelta, df_collection_data_type, delete_df_collection, ): @@ -166,9 +173,9 @@ class TestDFCollectionItemMethod: def test_update_partial_archive( self, df_collection, - offset, - duration, - thl_web_rw, + offset: str, + duration: timedelta, + thl_web_rw: PostgresConfig, df_collection_data_type, delete_df_collection, ): @@ -181,26 +188,26 @@ class TestDFCollectionItemMethod: def test_create_partial_archive( self, df_collection, - offset, - duration, + offset: str, + duration: str, create_main_accounts, - thl_web_rw, + thl_web_rw: PostgresConfig, thl_lm, df_collection_data_type, - user_factory, - product, + user_factory: Callable[..., User], + product: Product, client_no_amm, incite_item_factory, delete_df_collection, - mnt_filepath, + mnt_filepath: "GRLDatasets", ): assert 1 + 1 == 2 def test_dict( self, df_collection_data_type, - offset, - duration, + offset: str, + duration: timedelta, df_collection, delete_df_collection, ): @@ -224,12 +231,12 @@ class TestDFCollectionItemMethod: self, df_collection_data_type, df_collection, - offset, - duration, + offset: str, + duration: timedelta, create_main_accounts, - thl_web_rw, - user_factory, - product, + thl_web_rw: PostgresConfig, + user_factory: Callable[..., User], + product: Product, incite_item_factory, delete_df_collection, ): @@ -270,10 +277,10 @@ class TestDFCollectionItemMethod: self, df_collection_data_type, df_collection, - offset, - duration, - user_factory, - product, + offset: str, + duration: timedelta, + user_factory: Callable[..., User], + product: Product, incite_item_factory, delete_df_collection, ): @@ -316,15 +323,15 @@ class TestDFCollectionItemMethod: def test_from_mysql_ledger( self, df_collection, - user, + user: User, create_main_accounts, - offset, - duration, - thl_web_rw, + offset: str, + duration: timedelta, + thl_web_rw: PostgresConfig, thl_lm, df_collection_data_type, - user_factory, - product, + user_factory: Callable[..., User], + product: Product, client_no_amm, incite_item_factory, delete_df_collection, @@ -371,12 +378,12 @@ class TestDFCollectionItemMethod: def test_to_archive( self, df_collection, - user, - offset, - duration, + user: User, + offset: str, + duration: timedelta, df_collection_data_type, - user_factory, - product, + user_factory: Callable[..., User], + product: Product, client_no_amm, incite_item_factory, delete_df_collection, @@ -410,12 +417,12 @@ class TestDFCollectionItemMethod: self, df_collection_data_type, df_collection, - user_factory, - product, - offset, - duration, + user_factory: Callable[..., User], + product: Product, + offset: str, + duration: timedelta, client_no_amm, - user, + user: User, incite_item_factory, delete_df_collection, mnt_filepath, @@ -481,19 +488,19 @@ class TestDFCollectionItemMethod: @pytest.mark.skip def test_to_archive_numbered_partial( - self, df_collection_data_type, df_collection, offset, duration + self, df_collection_data_type, df_collection, offset: str, duration: timedelta ): pass @pytest.mark.skip def test_initial_load( - self, df_collection_data_type, df_collection, offset, duration + self, df_collection_data_type, df_collection, offset: str, duration: timedelta ): pass @pytest.mark.skip def test_clear_corrupt_archive( - self, df_collection_data_type, df_collection, offset, duration + self, df_collection_data_type, df_collection, offset: str, duration: timedelta ): pass @@ -505,28 +512,36 @@ class TestDFCollectionItemMethod: class TestDFCollectionItemMethodBase: @pytest.mark.skip - def test_path_exists(self, df_collection_data_type, offset, duration): + def test_path_exists( + self, df_collection_data_type, offset: str, duration: timedelta + ): pass @pytest.mark.skip - def test_next_numbered_path(self, df_collection_data_type, offset, duration): + def test_next_numbered_path( + self, df_collection_data_type, offset: str, duration: timedelta + ): pass @pytest.mark.skip def test_search_highest_numbered_path( - self, df_collection_data_type, offset, duration + self, df_collection_data_type, offset: str, duration: timedelta ): pass @pytest.mark.skip - def test_tmp_filename(self, df_collection_data_type, offset, duration): + def test_tmp_filename( + self, df_collection_data_type, offset: str, duration: timedelta + ): pass @pytest.mark.skip - def test_tmp_path(self, df_collection_data_type, offset, duration): + def test_tmp_path(self, df_collection_data_type, offset: str, duration: timedelta): pass - def test_is_empty(self, df_collection_data_type, df_collection, offset, duration): + def test_is_empty( + self, df_collection_data_type, df_collection, offset: str, duration: timedelta + ): """ test_has_empty was merged into this because item.has_empty is an alias for is_empty.. or vis-versa @@ -542,7 +557,7 @@ class TestDFCollectionItemMethodBase: assert item.has_empty() def test_has_partial_archive( - self, df_collection_data_type, df_collection, offset, duration + self, df_collection_data_type, df_collection, offset: str, duration: timedelta ): for item in df_collection.items: assert not item.has_partial_archive() @@ -550,7 +565,7 @@ class TestDFCollectionItemMethodBase: assert item.has_partial_archive() def test_has_archive( - self, df_collection_data_type, df_collection, offset, duration + self, df_collection_data_type, df_collection, offset: str, duration: timedelta ): for item in df_collection.items: # (1) Originally, nothing exists... so let's just make a file and @@ -587,7 +602,7 @@ class TestDFCollectionItemMethodBase: assert item.has_archive(include_empty=True) def test_delete_archive( - self, df_collection_data_type, df_collection, offset, duration + self, df_collection_data_type, df_collection, offset: str, duration: timedelta ): for item in df_collection.items: item: DFCollectionItem @@ -610,7 +625,7 @@ class TestDFCollectionItemMethodBase: assert not item.partial_path.exists() def test_should_archive( - self, df_collection_data_type, df_collection, offset, duration + self, df_collection_data_type, df_collection, offset: str, duration: timedelta ): schema: DataFrameSchema = df_collection._schema aa = schema.metadata[ARCHIVE_AFTER] @@ -627,11 +642,13 @@ class TestDFCollectionItemMethodBase: assert not item.should_archive() @pytest.mark.skip - def test_set_empty(self, df_collection_data_type, df_collection, offset, duration): + def test_set_empty( + self, df_collection_data_type, df_collection, offset: str, duration: timedelta + ): pass def test_valid_archive( - self, df_collection_data_type, df_collection, offset, duration + self, df_collection_data_type, df_collection, offset: str, duration: timedelta ): # Originally, nothing has been saved or anything.. so confirm it # always comes back as None @@ -655,17 +672,19 @@ class TestDFCollectionItemMethodBase: @pytest.mark.skip def test_validate_df( - self, df_collection_data_type, df_collection, offset, duration + self, df_collection_data_type, df_collection, offset: str, duration: timedelta ): pass @pytest.mark.skip def test_from_archive( - self, df_collection_data_type, df_collection, offset, duration + self, df_collection_data_type, df_collection, offset: str, duration: timedelta ): pass - def test__to_dict(self, df_collection_data_type, df_collection, offset, duration): + def test__to_dict( + self, df_collection_data_type, df_collection, offset: str, duration: timedelta + ): for item in df_collection.items: res = item._to_dict() @@ -683,19 +702,19 @@ class TestDFCollectionItemMethodBase: @pytest.mark.skip def test_delete_partial( - self, df_collection_data_type, df_collection, offset, duration + self, df_collection_data_type, df_collection, offset: str, duration: timedelta ): pass @pytest.mark.skip def test_cleanup_partials( - self, df_collection_data_type, df_collection, offset, duration + self, df_collection_data_type, df_collection, offset: str, duration: timedelta ): pass @pytest.mark.skip def test_delete_dangling_partials( - self, df_collection_data_type, df_collection, offset, duration + self, df_collection_data_type, df_collection, offset: str, duration: timedelta ): pass @@ -715,7 +734,7 @@ async def test_client(client, s, worker): ) @gen_cluster(client=True, nthreads=[("127.0.0.1", 1)]) @pytest.mark.anyio -async def test_client_parametrize(c, s, w, df_collection_data_type, offset): +async def test_client_parametrize(c, s, w, df_collection_data_type, offset: str): """c,s,a are all required - the secondary Worker (b) is not required""" assert isinstance(c, Client), f"c is not Client, it's {type(c)}" @@ -740,16 +759,16 @@ class TestDFCollectionItemFunctionalTest: def test_to_archive_and_ddf( self, df_collection_data_type, - offset, - duration, + offset: str, + duration: timedelta, client_no_amm, df_collection, - user, - user_factory, - product, + user: User, + user_factory: Callable[..., User], + product: Product, incite_item_factory, delete_df_collection, - mnt_filepath, + mnt_filepath: "GRLDatasets", ): from generalresearch.models.thl.user import User @@ -790,16 +809,16 @@ class TestDFCollectionItemFunctionalTest: def test_filesize_estimate( self, df_collection, - user, - offset, - duration, + user: User, + offset: str, + duration: timedelta, client_no_amm, - user_factory, - product, + user_factory: Callable[..., User], + product: Product, df_collection_data_type, incite_item_factory, delete_df_collection, - mnt_filepath, + mnt_filepath: "GRLDatasets", ): """A functional test to write some Parquet files for the DFCollection and then confirm that the files get written @@ -809,9 +828,11 @@ class TestDFCollectionItemFunctionalTest: (1) Validating their passing the pandera schema (2) The file or dir has an expected size on disk """ + import os + import pyarrow.parquet as pq + from generalresearch.models.thl.user import User - import os if df_collection.data_type in unsupported_mock_types: return @@ -838,14 +859,14 @@ class TestDFCollectionItemFunctionalTest: self, client_no_amm, df_collection, - user_factory, - product, - offset, - duration, + user_factory: Callable[..., User], + product: Product, + offset: str, + duration: timedelta, df_collection_data_type, incite_item_factory, delete_df_collection, - mnt_filepath, + mnt_filepath: "GRLDatasets", ): from generalresearch.models.thl.user import User @@ -875,7 +896,9 @@ class TestDFCollectionItemFunctionalTest: assert item.has_archive(include_empty=True) @pytest.mark.skip - def test_get_items(self, df_collection, product, offset, duration): + def test_get_items( + self, df_collection, product: Product, offset: str, duration: timedelta + ): with pytest.warns(expected_warning=ResourceWarning) as cm: df_collection.get_items_last365() assert "DFCollectionItem has missing archives" in str( @@ -892,11 +915,11 @@ class TestDFCollectionItemFunctionalTest: df_collection, incite_item_factory, delete_df_collection, - user_factory, - product, - offset, - duration, - mnt_filepath, + user_factory: Callable[..., User], + product: Product, + offset: str, + duration: timedelta, + mnt_filepath: "GRLDatasets", ): """Don't allow creating an archive for data that will likely be overwritten or updated @@ -934,10 +957,10 @@ class TestDFCollectionItemFunctionalTest: df_collection, incite_item_factory, delete_df_collection, - user, - offset, - duration, - mnt_filepath, + user: User, + offset: str, + duration: timedelta, + mnt_filepath: "GRLDatasets", ): delete_df_collection(coll=df_collection) @@ -962,10 +985,10 @@ class TestDFCollectionItemFunctionalTest: df_collection, incite_item_factory, delete_df_collection, - user_factory, - product, - offset, - duration, + user_factory: Callable[..., User], + product: Product, + offset: str, + duration: timedelta, mnt_filepath, ): from generalresearch.models.thl.user import User diff --git a/tests/incite/collections/test_df_collection_thl_marketplaces.py b/tests/incite/collections/test_df_collection_thl_marketplaces.py index 0a77938..54c27f7 100644 --- a/tests/incite/collections/test_df_collection_thl_marketplaces.py +++ b/tests/incite/collections/test_df_collection_thl_marketplaces.py @@ -1,11 +1,11 @@ from datetime import datetime, timezone from itertools import product +from typing import TYPE_CHECKING import pytest -from pandera import Column, Index, DataFrameSchema +from pandera import Column, DataFrameSchema, Index -from generalresearch.incite.collections import DFCollection -from generalresearch.incite.collections import DFCollectionType +from generalresearch.incite.collections import DFCollection, DFCollectionType from generalresearch.incite.collections.thl_marketplaces import ( InnovateSurveyHistoryCollection, MorningSurveyTimeseriesCollection, @@ -14,6 +14,9 @@ from generalresearch.incite.collections.thl_marketplaces import ( ) from test_utils.incite.conftest import mnt_filepath +if TYPE_CHECKING: + from generalresearch.incite.base import GRLDatasets + def combo_object(): for x in product( diff --git a/tests/incite/collections/test_df_collection_thl_web.py b/tests/incite/collections/test_df_collection_thl_web.py index e6f464b..51ca128 100644 --- a/tests/incite/collections/test_df_collection_thl_web.py +++ b/tests/incite/collections/test_df_collection_thl_web.py @@ -1,5 +1,6 @@ from datetime import datetime from itertools import product +from typing import TYPE_CHECKING import dask.dataframe as dd import pandas as pd @@ -8,6 +9,9 @@ from pandera import DataFrameSchema from generalresearch.incite.collections import DFCollection, DFCollectionType +if TYPE_CHECKING: + from generalresearch.incite.base import GRLDatasets + def combo_object(): for x in product( @@ -29,7 +33,7 @@ def combo_object(): ) class TestDFCollection_thl_web: - def test_init(self, df_collection_data_type, offset, df_collection): + def test_init(self, df_collection_data_type, offset: str, df_collection): assert isinstance(df_collection_data_type, DFCollectionType) assert isinstance(df_collection, DFCollection) @@ -39,12 +43,12 @@ class TestDFCollection_thl_web: ) class TestDFCollection_thl_web_Properties: - def test_items(self, df_collection_data_type, offset, df_collection): + def test_items(self, df_collection_data_type, offset: str, df_collection): assert isinstance(df_collection.items, list) for i in df_collection.items: assert i._collection == df_collection - def test__schema(self, df_collection_data_type, offset, df_collection): + def test__schema(self, df_collection_data_type, offset: str, df_collection): assert isinstance(df_collection._schema, DataFrameSchema) @@ -54,16 +58,16 @@ class TestDFCollection_thl_web_Properties: class TestDFCollection_thl_web_BaseProperties: @pytest.mark.skip - def test__interval_range(self, df_collection_data_type, offset, df_collection): + def test__interval_range(self, df_collection_data_type, offset: str, df_collection): pass - def test_interval_start(self, df_collection_data_type, offset, df_collection): + def test_interval_start(self, df_collection_data_type, offset: str, df_collection): assert isinstance(df_collection.interval_start, datetime) - def test_interval_range(self, df_collection_data_type, offset, df_collection): + def test_interval_range(self, df_collection_data_type, offset: str, df_collection): assert isinstance(df_collection.interval_range, list) - def test_progress(self, df_collection_data_type, offset, df_collection): + def test_progress(self, df_collection_data_type, offset: str, df_collection): assert isinstance(df_collection.progress, pd.DataFrame) @@ -78,7 +82,7 @@ class TestDFCollection_thl_web_Methods: @pytest.mark.skip def test_fetch_force_rr_latest( - self, df_collection_data_type, df_collection, offset + self, df_collection_data_type, df_collection, offset: str ): pass @@ -92,55 +96,63 @@ class TestDFCollection_thl_web_Methods: ) class TestDFCollection_thl_web_BaseMethods: - def test_fetch_all_paths(self, df_collection_data_type, offset, df_collection): + def test_fetch_all_paths(self, df_collection_data_type, offset: str, df_collection): res = df_collection.fetch_all_paths( items=None, force_rr_latest=False, include_partial=False ) assert isinstance(res, list) @pytest.mark.skip - def test_ddf(self, df_collection_data_type, offset, df_collection): + def test_ddf(self, df_collection_data_type, offset: str, df_collection): res = df_collection.ddf() assert isinstance(res, dd.DataFrame) # -- cleanup -- @pytest.mark.skip - def test_schedule_cleanup(self, df_collection_data_type, offset, df_collection): + def test_schedule_cleanup( + self, df_collection_data_type, offset: str, df_collection + ): pass @pytest.mark.skip - def test_cleanup(self, df_collection_data_type, offset, df_collection): + def test_cleanup(self, df_collection_data_type, offset: str, df_collection): pass @pytest.mark.skip - def test_cleanup_partials(self, df_collection_data_type, offset, df_collection): + def test_cleanup_partials( + self, df_collection_data_type, offset: str, df_collection + ): pass @pytest.mark.skip - def test_clear_tmp_archives(self, df_collection_data_type, offset, df_collection): + def test_clear_tmp_archives( + self, df_collection_data_type, offset: str, df_collection + ): pass @pytest.mark.skip def test_clear_corrupt_archives( - self, df_collection_data_type, offset, df_collection + self, df_collection_data_type, offset: str, df_collection ): pass @pytest.mark.skip - def test_rebuild_symlinks(self, df_collection_data_type, offset, df_collection): + def test_rebuild_symlinks( + self, df_collection_data_type, offset: str, df_collection + ): pass # -- Source timing -- @pytest.mark.skip - def test_get_item(self, df_collection_data_type, offset, df_collection): + def test_get_item(self, df_collection_data_type, offset: str, df_collection): pass @pytest.mark.skip - def test_get_item_start(self, df_collection_data_type, offset, df_collection): + def test_get_item_start(self, df_collection_data_type, offset: str, df_collection): pass @pytest.mark.skip - def test_get_items(self, df_collection_data_type, offset, df_collection): + def test_get_items(self, df_collection_data_type, offset: str, df_collection): # If we get all the items from the start of the collection, it # should include all the items! res1 = df_collection.items @@ -148,13 +160,19 @@ class TestDFCollection_thl_web_BaseMethods: assert len(res1) == len(res2) @pytest.mark.skip - def test_get_items_from_year(self, df_collection_data_type, offset, df_collection): + def test_get_items_from_year( + self, df_collection_data_type, offset: str, df_collection + ): pass @pytest.mark.skip - def test_get_items_last90(self, df_collection_data_type, offset, df_collection): + def test_get_items_last90( + self, df_collection_data_type, offset: str, df_collection + ): pass @pytest.mark.skip - def test_get_items_last365(self, df_collection_data_type, offset, df_collection): + def test_get_items_last365( + self, df_collection_data_type, offset: str, df_collection + ): pass diff --git a/tests/incite/mergers/foundations/test_enriched_session.py b/tests/incite/mergers/foundations/test_enriched_session.py index ec15d38..47f243e 100644 --- a/tests/incite/mergers/foundations/test_enriched_session.py +++ b/tests/incite/mergers/foundations/test_enriched_session.py @@ -1,16 +1,16 @@ -from datetime import timedelta, timezone, datetime +from datetime import datetime, timedelta, timezone from decimal import Decimal from itertools import product from typing import Optional -from generalresearch.incite.schemas.admin_responses import ( - AdminPOPSessionSchema, -) - import dask.dataframe as dd import pandas as pd import pytest +from generalresearch.incite.schemas.admin_responses import ( + AdminPOPSessionSchema, +) +from generalresearch.pg_helper import PostgresConfig from test_utils.incite.collections.conftest import ( session_collection, wall_collection, @@ -36,7 +36,7 @@ class TestEnrichedSession: wall_collection, session_collection, enriched_session_merge, - thl_web_rr, + thl_web_rr: PostgresConfig, delete_df_collection, incite_item_factory, ): @@ -95,7 +95,7 @@ class TestEnrichedSessionAdmin: client_no_amm, wall_collection, session_collection, - thl_web_rr, + thl_web_rr: PostgresConfig, session_report_request, user_factory, start, |
