aboutsummaryrefslogtreecommitdiff
path: root/tests/incite/collections
diff options
context:
space:
mode:
Diffstat (limited to 'tests/incite/collections')
-rw-r--r--tests/incite/collections/test_df_collection_item_thl_web.py26
-rw-r--r--tests/incite/collections/test_df_collection_thl_marketplaces.py2
-rw-r--r--tests/incite/collections/test_df_collection_thl_web.py27
3 files changed, 30 insertions, 25 deletions
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 a858fbe..8b8bcbe 100644
--- a/tests/incite/collections/test_df_collection_item_thl_web.py
+++ b/tests/incite/collections/test_df_collection_item_thl_web.py
@@ -1,3 +1,6 @@
+from __future__ import annotations
+
+from collections.abc import Generator
from datetime import datetime, timedelta, timezone
from itertools import product as iter_product
from os.path import join as pjoin
@@ -12,13 +15,7 @@ from distributed import Client, Scheduler, Worker
# noinspection PyUnresolvedReferences
from distributed.utils_test import (
- cleanup,
- client,
- client_no_amm,
- cluster_fixture,
gen_cluster,
- loop,
- loop_in_thread,
)
from faker import Faker
from pandera.pandas import DataFrameSchema
@@ -34,7 +31,6 @@ 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 incite_item_factory, mnt_filepath
if TYPE_CHECKING:
from generalresearch.incite.base import GRLDatasets
@@ -56,12 +52,12 @@ unsupported_mock_types = {
}
-def combo_object():
+def combo_object() -> Generator[str, None, None]:
for x in iter_product(
df_collections,
["15min", "45min", "1H"],
):
- yield x
+ yield from x
class TestDFCollectionItemBase:
@@ -199,7 +195,7 @@ class TestDFCollectionItemMethod:
client_no_amm,
incite_item_factory,
delete_df_collection,
- mnt_filepath: "GRLDatasets",
+ mnt_filepath: GRLDatasets,
):
assert 1 + 1 == 2
@@ -768,7 +764,7 @@ class TestDFCollectionItemFunctionalTest:
product: Product,
incite_item_factory,
delete_df_collection,
- mnt_filepath: "GRLDatasets",
+ mnt_filepath: GRLDatasets,
):
from generalresearch.models.thl.user import User
@@ -818,7 +814,7 @@ class TestDFCollectionItemFunctionalTest:
df_collection_data_type,
incite_item_factory,
delete_df_collection,
- mnt_filepath: "GRLDatasets",
+ mnt_filepath: GRLDatasets,
):
"""A functional test to write some Parquet files for the
DFCollection and then confirm that the files get written
@@ -866,7 +862,7 @@ class TestDFCollectionItemFunctionalTest:
df_collection_data_type,
incite_item_factory,
delete_df_collection,
- mnt_filepath: "GRLDatasets",
+ mnt_filepath: GRLDatasets,
):
from generalresearch.models.thl.user import User
@@ -919,7 +915,7 @@ class TestDFCollectionItemFunctionalTest:
product: Product,
offset: str,
duration: timedelta,
- mnt_filepath: "GRLDatasets",
+ mnt_filepath: GRLDatasets,
):
"""Don't allow creating an archive for data that will likely be
overwritten or updated
@@ -960,7 +956,7 @@ class TestDFCollectionItemFunctionalTest:
user: User,
offset: str,
duration: timedelta,
- mnt_filepath: "GRLDatasets",
+ mnt_filepath: GRLDatasets,
):
delete_df_collection(coll=df_collection)
diff --git a/tests/incite/collections/test_df_collection_thl_marketplaces.py b/tests/incite/collections/test_df_collection_thl_marketplaces.py
index 8ce8acc..981f62e 100644
--- a/tests/incite/collections/test_df_collection_thl_marketplaces.py
+++ b/tests/incite/collections/test_df_collection_thl_marketplaces.py
@@ -28,7 +28,7 @@ def combo_object():
],
["5min", "6H", "30D"],
):
- yield x
+ yield from x
@pytest.mark.parametrize("df_coll, offset", combo_object())
diff --git a/tests/incite/collections/test_df_collection_thl_web.py b/tests/incite/collections/test_df_collection_thl_web.py
index c64dac8..b09d44c 100644
--- a/tests/incite/collections/test_df_collection_thl_web.py
+++ b/tests/incite/collections/test_df_collection_thl_web.py
@@ -1,3 +1,6 @@
+from __future__ import annotations
+
+from collections.abc import Generator
from datetime import datetime
from itertools import product
from typing import TYPE_CHECKING
@@ -11,9 +14,13 @@ from generalresearch.incite.collections import DFCollection, DFCollectionType
if TYPE_CHECKING:
from generalresearch.incite.base import GRLDatasets
+ from generalresearch.incite.collections import (
+ DFCollectionItem,
+ DFCollectionType,
+ )
-def combo_object():
+def combo_object() -> Generator[tuple, None, None]:
for x in product(
[
DFCollectionType.USER,
@@ -25,7 +32,7 @@ def combo_object():
],
["30min", "1H"],
):
- yield x
+ yield from x
@pytest.mark.parametrize(
@@ -33,7 +40,9 @@ def combo_object():
)
class TestDFCollection_thl_web:
- def test_init(self, df_collection_data_type, offset: str, df_collection):
+ def test_init(
+ self, df_collection_data_type: DFCollectionType, offset: str, df_collection
+ ):
assert isinstance(df_collection_data_type, DFCollectionType)
assert isinstance(df_collection, DFCollection)
@@ -43,12 +52,12 @@ class TestDFCollection_thl_web:
)
class TestDFCollection_thl_web_Properties:
- def test_items(self, df_collection_data_type, offset: str, df_collection):
+ def test_items(self, 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: str, df_collection):
+ def test__schema(self, df_collection):
assert isinstance(df_collection._schema, DataFrameSchema)
@@ -58,16 +67,16 @@ class TestDFCollection_thl_web_Properties:
class TestDFCollection_thl_web_BaseProperties:
@pytest.mark.skip
- def test__interval_range(self, df_collection_data_type, offset: str, df_collection):
+ def test__interval_range(self, df_collection):
pass
- def test_interval_start(self, df_collection_data_type, offset: str, df_collection):
+ def test_interval_start(self, df_collection):
assert isinstance(df_collection.interval_start, datetime)
- def test_interval_range(self, df_collection_data_type, offset: str, df_collection):
+ def test_interval_range(self, df_collection):
assert isinstance(df_collection.interval_range, list)
- def test_progress(self, df_collection_data_type, offset: str, df_collection):
+ def test_progress(self, df_collection):
assert isinstance(df_collection.progress, pd.DataFrame)