aboutsummaryrefslogtreecommitdiff
path: root/tests/incite
diff options
context:
space:
mode:
authorMax Nanis2026-08-25 11:09:52 -0700
committerMax Nanis2026-08-25 11:09:52 -0700
commit3b4059135be47f7752a08e4277a85f9e57ceaa9d (patch)
tree122561f7cc99aeb2933a4fc37d07b3eecd514701 /tests/incite
parent5682f48a96b0713929a4bb52e72eec5907d5dd32 (diff)
downloadgeneralresearch-3b4059135be47f7752a08e4277a85f9e57ceaa9d.tar.gz
generalresearch-3b4059135be47f7752a08e4277a85f9e57ceaa9d.zip
Ruff typing from this morning. WIP
Diffstat (limited to 'tests/incite')
-rw-r--r--tests/incite/collections/test_df_collection_base.py2
-rw-r--r--tests/incite/collections/test_df_collection_item_base.py2
-rw-r--r--tests/incite/collections/test_df_collection_item_thl_web.py61
-rw-r--r--tests/incite/mergers/foundations/test_enriched_session.py18
-rw-r--r--tests/incite/mergers/foundations/test_enriched_task_adjust.py12
-rw-r--r--tests/incite/mergers/foundations/test_enriched_wall.py36
-rw-r--r--tests/incite/mergers/test_pop_ledger.py34
-rw-r--r--tests/incite/mergers/test_ym_survey_merge.py12
8 files changed, 88 insertions, 89 deletions
diff --git a/tests/incite/collections/test_df_collection_base.py b/tests/incite/collections/test_df_collection_base.py
index 176bf4b..b9f0181 100644
--- a/tests/incite/collections/test_df_collection_base.py
+++ b/tests/incite/collections/test_df_collection_base.py
@@ -89,7 +89,7 @@ class TestDFCollectionBaseMethods:
@pytest.mark.skip
def test_initial_load(self, mnt_filepath: GRLDatasets, thl_web_rr):
instance = DFCollection(
- pg_config=thl_web_rr,
+ pg_config=thl_web_rr: PostgresConfig,
data_type=DFCollectionType.USER,
start=datetime(year=2022, month=1, day=1, minute=0, tzinfo=UTC),
finished=datetime(year=2022, month=1, day=1, minute=5, tzinfo=UTC),
diff --git a/tests/incite/collections/test_df_collection_item_base.py b/tests/incite/collections/test_df_collection_item_base.py
index 0218f30..9a2ecf3 100644
--- a/tests/incite/collections/test_df_collection_item_base.py
+++ b/tests/incite/collections/test_df_collection_item_base.py
@@ -66,7 +66,7 @@ class TestDFCollectionItemMethods:
start=datetime(year=1800, month=1, day=1, tzinfo=UTC),
finished=datetime(year=1900, month=1, day=1, tzinfo=UTC),
archive_path=mnt_filepath.archive_path(enum_type=df_coll_type),
- pg_config=thl_web_rr,
+ pg_config=thl_web_rr: PostgresConfig,
)
# Has RR, assume unittest server is online
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 3d70e56..8038d3b 100644
--- a/tests/incite/collections/test_df_collection_item_thl_web.py
+++ b/tests/incite/collections/test_df_collection_item_thl_web.py
@@ -143,7 +143,7 @@ class TestDFCollectionItemMethod:
offset: str,
duration: timedelta,
df_collection_data_type,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
):
delete_df_collection(coll=df_collection)
@@ -173,7 +173,7 @@ class TestDFCollectionItemMethod:
duration: timedelta,
thl_web_rw: PostgresConfig,
df_collection_data_type,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
):
# for i in collection.items:
# assert i.update_partial_archive()
@@ -186,15 +186,15 @@ class TestDFCollectionItemMethod:
df_collection,
offset: str,
duration: str,
- create_main_accounts,
+ create_main_accounts: Callable[..., None],
thl_web_rw: PostgresConfig,
thl_lm,
df_collection_data_type,
user_factory: Callable[..., User],
- product: Product,
+ product: product: Product,
client_no_amm,
incite_item_factory,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
mnt_filepath: GRLDatasets,
):
assert 1 + 1 == 2
@@ -205,7 +205,7 @@ class TestDFCollectionItemMethod:
offset: str,
duration: timedelta,
df_collection,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
):
delete_df_collection(coll=df_collection)
@@ -229,12 +229,12 @@ class TestDFCollectionItemMethod:
df_collection,
offset: str,
duration: timedelta,
- create_main_accounts,
+ create_main_accounts: Callable[..., None],
thl_web_rw: PostgresConfig,
user_factory: Callable[..., User],
- product: Product,
+ product: product: Product,
incite_item_factory,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
):
if df_collection.data_type in unsupported_mock_types:
@@ -275,9 +275,9 @@ class TestDFCollectionItemMethod:
offset: str,
duration: timedelta,
user_factory: Callable[..., User],
- product: Product,
+ product: product: Product,
incite_item_factory,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
):
if df_collection.data_type in unsupported_mock_types:
@@ -318,17 +318,17 @@ class TestDFCollectionItemMethod:
self,
df_collection,
user: User,
- create_main_accounts,
+ create_main_accounts: Callable[..., None],
offset: str,
duration: timedelta,
thl_web_rw: PostgresConfig,
thl_lm,
df_collection_data_type,
user_factory: Callable[..., User],
- product: Product,
+ product: product: Product,
client_no_amm,
incite_item_factory,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
mnt_filepath,
):
@@ -376,10 +376,10 @@ class TestDFCollectionItemMethod:
duration: timedelta,
df_collection_data_type,
user_factory: Callable[..., User],
- product: Product,
+ product: product: Product,
client_no_amm,
incite_item_factory,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
mnt_filepath,
):
@@ -410,13 +410,13 @@ class TestDFCollectionItemMethod:
df_collection_data_type,
df_collection,
user_factory: Callable[..., User],
- product: Product,
+ product: product: Product,
offset: str,
duration: timedelta,
client_no_amm,
user: User,
incite_item_factory,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
mnt_filepath,
):
"""We already have a test for the "non-private" version of this,
@@ -757,9 +757,9 @@ class TestDFCollectionItemFunctionalTest:
df_collection,
user: User,
user_factory: Callable[..., User],
- product: Product,
+ product: product: Product,
incite_item_factory,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
mnt_filepath: GRLDatasets,
):
@@ -805,10 +805,10 @@ class TestDFCollectionItemFunctionalTest:
duration: timedelta,
client_no_amm,
user_factory: Callable[..., User],
- product: Product,
+ product: product: Product,
df_collection_data_type,
incite_item_factory,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
mnt_filepath: GRLDatasets,
):
"""A functional test to write some Parquet files for the
@@ -823,7 +823,6 @@ class TestDFCollectionItemFunctionalTest:
import pyarrow.parquet as pq
-
if df_collection.data_type in unsupported_mock_types:
return
delete_df_collection(coll=df_collection)
@@ -850,12 +849,12 @@ class TestDFCollectionItemFunctionalTest:
client_no_amm,
df_collection,
user_factory: Callable[..., User],
- product: Product,
+ product: product: Product,
offset: str,
duration: timedelta,
df_collection_data_type,
incite_item_factory,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
mnt_filepath: GRLDatasets,
):
@@ -886,7 +885,7 @@ class TestDFCollectionItemFunctionalTest:
@pytest.mark.skip
def test_get_items(
- self, df_collection, product: Product, offset: str, duration: timedelta
+ self, df_collection, product: product: Product, offset: str, duration: timedelta
):
with pytest.warns(expected_warning=ResourceWarning) as cm:
df_collection.get_items_last365()
@@ -903,9 +902,9 @@ class TestDFCollectionItemFunctionalTest:
df_collection_data_type,
df_collection,
incite_item_factory,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
user_factory: Callable[..., User],
- product: Product,
+ product: product: Product,
offset: str,
duration: timedelta,
mnt_filepath: GRLDatasets,
@@ -944,7 +943,7 @@ class TestDFCollectionItemFunctionalTest:
df_collection_data_type,
df_collection,
incite_item_factory,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
user: User,
offset: str,
duration: timedelta,
@@ -972,9 +971,9 @@ class TestDFCollectionItemFunctionalTest:
df_collection_data_type,
df_collection,
incite_item_factory,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
user_factory: Callable[..., User],
- product: Product,
+ product: product: Product,
offset: str,
duration: timedelta,
mnt_filepath,
diff --git a/tests/incite/mergers/foundations/test_enriched_session.py b/tests/incite/mergers/foundations/test_enriched_session.py
index ba11725..8254d81 100644
--- a/tests/incite/mergers/foundations/test_enriched_session.py
+++ b/tests/incite/mergers/foundations/test_enriched_session.py
@@ -26,20 +26,20 @@ class TestEnrichedSession:
def test_base(
self,
client_no_amm,
- product,
- user_factory,
+ product: Product,
+ user_factory: Callable[..., User],
wall_collection,
session_collection,
enriched_session_merge,
thl_web_rr: PostgresConfig,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
incite_item_factory,
):
from generalresearch.models.thl.user import User
delete_df_collection(coll=session_collection)
- u1: User = user_factory(product=product, created=session_collection.start)
+ u1: User = user_factory(product=product: Product, created=session_collection.start)
for item in session_collection.items:
incite_item_factory(item=item, user=u1)
@@ -52,7 +52,7 @@ class TestEnrichedSession:
client=client_no_amm,
wall_coll=wall_collection,
session_coll=session_collection,
- pg_config=thl_web_rr,
+ pg_config=thl_web_rr: PostgresConfig,
)
# --
@@ -92,11 +92,11 @@ class TestEnrichedSessionAdmin:
session_collection,
thl_web_rr: PostgresConfig,
session_report_request,
- user_factory,
+ user_factory: Callable[..., User],
start,
session_factory,
- product_factory,
- delete_df_collection,
+ product_factory: Callable[..., Product],
+ delete_df_collection: Callable[..., None],
):
delete_df_collection(coll=wall_collection)
delete_df_collection(coll=session_collection)
@@ -120,7 +120,7 @@ class TestEnrichedSessionAdmin:
client=client_no_amm,
session_coll=session_collection,
wall_coll=wall_collection,
- pg_config=thl_web_rr,
+ pg_config=thl_web_rr: PostgresConfig,
)
df = enriched_session_merge.to_admin_response(
diff --git a/tests/incite/mergers/foundations/test_enriched_task_adjust.py b/tests/incite/mergers/foundations/test_enriched_task_adjust.py
index 8c3a647..a33a55a 100644
--- a/tests/incite/mergers/foundations/test_enriched_task_adjust.py
+++ b/tests/incite/mergers/foundations/test_enriched_task_adjust.py
@@ -21,16 +21,16 @@ class TestEnrichedTaskAdjust:
def test_base(
self,
client_no_amm,
- user_factory,
- product,
+ user_factory: Callable[..., User],
+ product: Product,
task_adj_collection,
wall_collection,
session_collection,
enriched_wall_merge,
enriched_task_adjust_merge,
incite_item_factory,
- delete_df_collection,
- thl_web_rr,
+ delete_df_collection: Callable[..., None],
+ thl_web_rr: PostgresConfig,
):
from generalresearch.models.thl.user import User
@@ -48,14 +48,14 @@ class TestEnrichedTaskAdjust:
client=client_no_amm,
session_coll=session_collection,
wall_coll=wall_collection,
- pg_config=thl_web_rr,
+ pg_config=thl_web_rr: PostgresConfig,
)
enriched_task_adjust_merge.build(
client=client_no_amm,
task_adjust_coll=task_adj_collection,
enriched_wall=enriched_wall_merge,
- pg_config=thl_web_rr,
+ pg_config=thl_web_rr: PostgresConfig,
)
# --
diff --git a/tests/incite/mergers/foundations/test_enriched_wall.py b/tests/incite/mergers/foundations/test_enriched_wall.py
index 0e28bce..a0ca4dd 100644
--- a/tests/incite/mergers/foundations/test_enriched_wall.py
+++ b/tests/incite/mergers/foundations/test_enriched_wall.py
@@ -21,13 +21,13 @@ class TestEnrichedWall:
def test_base(
self,
client_no_amm,
- product,
- user_factory,
+ product: Product,
+ user_factory: Callable[..., User],
wall_collection,
- thl_web_rr,
+ thl_web_rr: PostgresConfig,
session_collection,
enriched_wall_merge,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
incite_item_factory,
):
from generalresearch.models.thl.user import User
@@ -35,7 +35,7 @@ class TestEnrichedWall:
# -- Build & Setup
delete_df_collection(coll=session_collection)
delete_df_collection(coll=wall_collection)
- u1: User = user_factory(product=product, created=session_collection.start)
+ u1: User = user_factory(product=product: Product, created=session_collection.start)
for item in session_collection.items:
incite_item_factory(item=item, user=u1)
@@ -48,7 +48,7 @@ class TestEnrichedWall:
client=client_no_amm,
wall_coll=wall_collection,
session_coll=session_collection,
- pg_config=thl_web_rr,
+ pg_config=thl_web_rr: PostgresConfig,
)
# --
@@ -64,18 +64,18 @@ class TestEnrichedWall:
def test_base_item(
self,
client_no_amm,
- product,
- user_factory,
+ product: Product,
+ user_factory: Callable[..., User],
wall_collection,
session_collection,
enriched_wall_merge,
- delete_df_collection,
- thl_web_rr,
+ delete_df_collection: Callable[..., None],
+ thl_web_rr: PostgresConfig,
incite_item_factory,
):
# -- Build & Setup
delete_df_collection(coll=session_collection)
- u = user_factory(product=product, created=session_collection.start)
+ u = user_factory(product=product: Product, created=session_collection.start)
for item in session_collection.items:
incite_item_factory(item=item, user=u)
@@ -87,7 +87,7 @@ class TestEnrichedWall:
client=client_no_amm,
wall_coll=wall_collection,
session_coll=session_collection,
- pg_config=thl_web_rr,
+ pg_config=thl_web_rr: PostgresConfig,
)
# --
@@ -106,7 +106,7 @@ class TestEnrichedWall:
client=client_no_amm,
wall_coll=wall_collection,
session_coll=session_collection,
- pg_config=thl_web_rr,
+ pg_config=thl_web_rr: PostgresConfig,
)
modified_time2 = path.stat().st_mtime
@@ -172,12 +172,12 @@ class TestEnrichedWallToAdmin:
client_no_amm,
wall_collection,
session_collection,
- thl_web_rr,
+ thl_web_rr: PostgresConfig,
user,
session_factory,
- delete_df_collection,
- product_factory,
- user_factory,
+ delete_df_collection: Callable[..., None],
+ product_factory: Callable[..., Product],
+ user_factory: Callable[..., User],
start,
):
delete_df_collection(coll=wall_collection)
@@ -203,7 +203,7 @@ class TestEnrichedWallToAdmin:
client=client_no_amm,
wall_coll=wall_collection,
session_coll=session_collection,
- pg_config=thl_web_rr,
+ pg_config=thl_web_rr: PostgresConfig,
)
df = enriched_wall_merge.to_admin_response(
diff --git a/tests/incite/mergers/test_pop_ledger.py b/tests/incite/mergers/test_pop_ledger.py
index dc01179..d054eb6 100644
--- a/tests/incite/mergers/test_pop_ledger.py
+++ b/tests/incite/mergers/test_pop_ledger.py
@@ -33,17 +33,17 @@ class TestMergePOPLedger:
client_no_amm,
ledger_collection,
pop_ledger_merge,
- product,
- user_factory,
- create_main_accounts,
+ product: Product,
+ user_factory: Callable[..., User],
+ create_main_accounts: Callable[..., None],
thl_lm,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
incite_item_factory,
- delete_ledger_db,
+ delete_ledger_db: Callable[..., None],
):
from generalresearch.models.thl.ledger import LedgerAccount
- u = user_factory(product=product, created=ledger_collection.start)
+ u = user_factory(product=product: Product, created=ledger_collection.start)
# -- Build & Setup
delete_ledger_db()
@@ -127,26 +127,26 @@ class TestMergePOPLedger:
ledger_collection,
pop_ledger_merge,
mnt_filepath,
- product,
- user_factory,
- create_main_accounts,
+ product: Product,
+ user_factory: Callable[..., User],
+ create_main_accounts: Callable[..., None],
offset,
duration,
start,
thl_lm,
incite_item_factory,
- delete_df_collection,
- delete_ledger_db,
+ delete_df_collection: Callable[..., None],
+ delete_ledger_db: Callable[..., None],
session_collection,
):
from generalresearch.models.thl.finance import ProductBalances
from generalresearch.models.thl.ledger import LedgerAccount
from generalresearch.models.thl.product import Product
- u = user_factory(product=product, created=session_collection.start)
+ u = user_factory(product=product: Product, created=session_collection.start)
assert ledger_collection.finished is not None
- assert isinstance(u.product, Product)
+ assert isinstance(u.product: Product, Product)
delete_ledger_db()
create_main_accounts(),
delete_df_collection(coll=ledger_collection)
@@ -228,14 +228,14 @@ class TestMergePOPLedger:
ledger_collection,
pop_ledger_merge,
mnt_filepath,
- user_factory,
- product,
- create_main_accounts,
+ user_factory: Callable[..., User],
+ product: Product,
+ create_main_accounts: Callable[..., None],
offset,
duration,
start,
thl_lm,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
incite_item_factory,
):
from generalresearch.models.thl.user import User
diff --git a/tests/incite/mergers/test_ym_survey_merge.py b/tests/incite/mergers/test_ym_survey_merge.py
index 850df8a..a0b8b87 100644
--- a/tests/incite/mergers/test_ym_survey_merge.py
+++ b/tests/incite/mergers/test_ym_survey_merge.py
@@ -28,20 +28,20 @@ class TestYMSurveyMerge:
def test_base(
self,
client_no_amm,
- user_factory,
- product,
+ user_factory: Callable[..., User],
+ product: Product,
ym_survey_wall_merge,
wall_collection,
session_collection,
enriched_session_merge,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
incite_item_factory,
- thl_web_rr,
+ thl_web_rr: PostgresConfig,
):
from generalresearch.models.thl.user import User
delete_df_collection(coll=session_collection)
- user: User = user_factory(product=product, created=session_collection.start)
+ user: User = user_factory(product=product: Product, created=session_collection.start)
# -- Build & Setup
assert ym_survey_wall_merge.start is None
@@ -61,7 +61,7 @@ class TestYMSurveyMerge:
client=client_no_amm,
session_coll=session_collection,
wall_coll=wall_collection,
- pg_config=thl_web_rr,
+ pg_config=thl_web_rr: PostgresConfig,
)
assert enriched_session_merge.progress.has_archive.eq(True).all()