aboutsummaryrefslogtreecommitdiff
path: root/tests/models
diff options
context:
space:
mode:
Diffstat (limited to 'tests/models')
-rw-r--r--tests/models/gr/test_authentication.py50
-rw-r--r--tests/models/gr/test_business.py122
-rw-r--r--tests/models/gr/test_team.py14
-rw-r--r--tests/models/legacy/test_user_question_answer_in.py16
-rw-r--r--tests/models/test_finance.py28
-rw-r--r--tests/models/thl/test_adjustments.py2
-rw-r--r--tests/models/thl/test_contest/test_leaderboard_contest.py2
-rw-r--r--tests/models/thl/test_contest/test_raffle_contest.py2
-rw-r--r--tests/models/thl/test_payout.py2
-rw-r--r--tests/models/thl/test_product.py78
-rw-r--r--tests/models/thl/test_user.py6
11 files changed, 165 insertions, 157 deletions
diff --git a/tests/models/gr/test_authentication.py b/tests/models/gr/test_authentication.py
index ac39e64..d4db112 100644
--- a/tests/models/gr/test_authentication.py
+++ b/tests/models/gr/test_authentication.py
@@ -44,10 +44,10 @@ class TestGRUser:
gr_user_token,
gr_user: GRUser,
membership: Membership,
- product_factory,
+ product_factory: Callable[..., Product],
membership_factory,
team: Team,
- thl_web_rr,
+ thl_web_rr: PostgresConfig,
gr_redis_config,
gr_db,
):
@@ -64,11 +64,11 @@ class TestGRUser:
def test_products(
self,
gr_user: GRUser,
- product_factory,
+ product_factory: Callable[..., Product],
team: Team,
membership: Membership,
gr_db,
- thl_web_rr,
+ thl_web_rr: PostgresConfig,
gr_redis_config,
):
from generalresearch.models.thl.product import Product
@@ -87,7 +87,7 @@ class TestGRUser:
gr_user.prefetch_products(
pg_config=gr_db,
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
redis_config=gr_redis_config,
)
assert isinstance(gr_user.products, list)
@@ -107,8 +107,8 @@ class TestGRUserMethods:
gr_user: GRUser,
gr_redis,
team: Team,
- business,
- product_factory,
+ business: Business,
+ product_factory: Callable[..., Product],
membership_factory: Callable[Membership],
):
product_factory(team=team, business=business)
@@ -128,7 +128,7 @@ class TestGRUserMethods:
gr_user_token,
gr_redis,
gr_db,
- thl_web_rr,
+ thl_web_rr: PostgresConfig,
gr_redis_config,
):
assert gr_redis.get(name=gr_user.cache_key) is None
@@ -137,7 +137,7 @@ class TestGRUserMethods:
assert gr_redis.get(name=f"{gr_user.cache_key}:product_uuids") is None
gr_user.set_cache(
- pg_config=gr_db, thl_web_rr=thl_web_rr, redis_config=gr_redis_config
+ pg_config=gr_db, thl_web_rr=thl_web_rr: PostgresConfig, redis_config=gr_redis_config
)
assert gr_redis.get(name=gr_user.cache_key) is not None
@@ -152,11 +152,11 @@ class TestGRUserMethods:
gr_redis,
gr_redis_config,
gr_db,
- thl_web_rr,
- product_factory,
+ thl_web_rr: PostgresConfig,
+ product_factory: Callable[..., Product],
team,
membership_factory,
- thl_redis_config,
+ thl_redis_config: RedisConfig,
):
from generalresearch.models.gr.authentication import GRUser
@@ -164,7 +164,7 @@ class TestGRUserMethods:
membership_factory(team=team, gr_user=gr_user)
gr_user.set_cache(
- pg_config=gr_db, thl_web_rr=thl_web_rr, redis_config=gr_redis_config
+ pg_config=gr_db, thl_web_rr=thl_web_rr: PostgresConfig, redis_config=gr_redis_config
)
res: str = gr_redis.get(name=gr_user.cache_key)
@@ -176,8 +176,8 @@ class TestGRUserMethods:
gru2.prefetch_products(
pg_config=gr_db,
- thl_pg_config=thl_web_rr,
- redis_config=thl_redis_config,
+ thl_pg_config=thl_web_rr: PostgresConfig,
+ redis_config=thl_redis_config: RedisConfig,
)
assert gru2.product_uuids == [p1.uuid]
@@ -188,15 +188,15 @@ class TestGRUserMethods:
gr_user_token,
gr_redis,
gr_db,
- thl_web_rr,
- product_factory,
+ thl_web_rr: PostgresConfig,
+ product_factory: Callable[..., Product],
team,
gr_redis_config,
):
product_factory(team=team)
gr_user.set_cache(
- pg_config=gr_db, thl_web_rr=thl_web_rr, redis_config=gr_redis_config
+ pg_config=gr_db, thl_web_rr=thl_web_rr: PostgresConfig, redis_config=gr_redis_config
)
res = json.loads(gr_redis.get(name=f"{gr_user.cache_key}:team_uuids"))
assert len(res) == 1
@@ -208,16 +208,16 @@ class TestGRUserMethods:
gr_user: GRUser,
gr_redis,
gr_db,
- thl_web_rr,
- product_factory,
- business,
+ thl_web_rr: PostgresConfig,
+ product_factory: Callable[..., Product],
+ business: Business,
team,
gr_redis_config,
):
product_factory(team=team, business=business)
gr_user.set_cache(
- pg_config=gr_db, thl_web_rr=thl_web_rr, redis_config=gr_redis_config
+ pg_config=gr_db, thl_web_rr=thl_web_rr: PostgresConfig, redis_config=gr_redis_config
)
res = json.loads(gr_redis.get(name=f"{gr_user.cache_key}:business_uuids"))
assert len(res) == 1
@@ -230,15 +230,15 @@ class TestGRUserMethods:
gr_user_token,
gr_redis,
gr_db,
- thl_web_rr,
- product_factory,
+ thl_web_rr: PostgresConfig,
+ product_factory: Callable[..., Product],
team,
gr_redis_config,
):
product_factory(team=team)
gr_user.set_cache(
- pg_config=gr_db, thl_web_rr=thl_web_rr, redis_config=gr_redis_config
+ pg_config=gr_db, thl_web_rr=thl_web_rr: PostgresConfig, redis_config=gr_redis_config
)
res = json.loads(gr_redis.get(name=f"{gr_user.cache_key}:product_uuids"))
assert len(res) == 1
diff --git a/tests/models/gr/test_business.py b/tests/models/gr/test_business.py
index 48a7bb0..5239ac2 100644
--- a/tests/models/gr/test_business.py
+++ b/tests/models/gr/test_business.py
@@ -29,7 +29,7 @@ from generalresearch.managers.thl.payout import (
PayoutEventManager,
)
from generalresearch.models.gr.business import (
- Business,
+ business: Business,
BusinessAddress,
BusinessBankAccount,
BusinessContact,
@@ -50,7 +50,7 @@ class TestBusinessBankAccount:
def test_init(
self,
- business: Business,
+ business: business: Business,
business_bank_account_manager: BusinessBankAccountManager,
):
from generalresearch.models.gr.business import (
@@ -68,7 +68,7 @@ class TestBusinessBankAccount:
def test_business(
self,
business_bank_account: BusinessBankAccount,
- business: Business,
+ business: business: Business,
gr_db: PostgresConfig,
gr_redis_config: RedisConfig,
):
@@ -79,7 +79,7 @@ class TestBusinessBankAccount:
business_bank_account.prefetch_business(
pg_config=gr_db, redis_config=gr_redis_config
)
- assert isinstance(business_bank_account.business, Business)
+ assert isinstance(business_bank_account.business: Business, Business)
assert business_bank_account.business.uuid == business.uuid
@@ -112,13 +112,13 @@ class TestBusiness:
def test_init(self, business: Business):
- assert isinstance(business, Business)
+ assert isinstance(business: Business, Business)
assert isinstance(business.id, int)
assert isinstance(business.uuid, str)
def test_str_and_repr(
self,
- business: Business,
+ business: business: Business,
product_factory: Callable[..., Product],
thl_web_rr: PostgresConfig,
ledger_manager: LedgerManager,
@@ -181,12 +181,12 @@ class TestBusiness:
pop_ledger_merge.build(client=client_no_amm, ledger_coll=ledger_collection)
business.prebuild_payouts(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
thl_lm=thl_ledger_manager,
bpem=business_payout_event_manager,
)
business.prebuild_balance(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
lm=ledger_manager,
ds=mnt_filepath,
client=client_no_amm,
@@ -198,7 +198,7 @@ class TestBusiness:
def test_addresses(
self,
- business: Business,
+ business: business: Business,
business_address: BusinessAddress,
gr_db: PostgresConfig,
):
@@ -213,7 +213,7 @@ class TestBusiness:
def test_teams(
self,
- business: Business,
+ business: business: Business,
team: Team,
team_manager: TeamManager,
gr_db: PostgresConfig,
@@ -231,7 +231,7 @@ class TestBusiness:
def test_products(
self,
- business: Business,
+ business: business: Business,
product_factory: Callable[..., Product],
thl_web_rr: PostgresConfig,
):
@@ -254,7 +254,7 @@ class TestBusiness:
business.prefetch_products(thl_pg_config=thl_web_rr)
assert len(business.products) == 3
- def test_bank_accounts(self, business: Business, gr_db: PostgresConfig):
+ def test_bank_accounts(self, business: business: Business, gr_db: PostgresConfig):
assert business.products is None
# It's an empty list after prefetch
@@ -264,7 +264,7 @@ class TestBusiness:
def test_balance(
self,
- business: Business,
+ business: business: Business,
mnt_filepath: GRLDatasets,
client_no_amm: DaskClient,
thl_web_rr: PostgresConfig,
@@ -275,7 +275,7 @@ class TestBusiness:
with pytest.raises(expected_exception=AssertionError) as cm:
business.prebuild_balance(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
lm=ledger_manager,
ds=mnt_filepath,
client=client_no_amm,
@@ -289,7 +289,7 @@ class TestBusiness:
def test_payouts_no_accounts(
self,
- business: Business,
+ business: business: Business,
product_factory: Callable[..., Product],
thl_web_rr: PostgresConfig,
thl_ledger_manager: ThlLedgerManager,
@@ -299,7 +299,7 @@ class TestBusiness:
with pytest.raises(expected_exception=AssertionError) as cm:
business.prebuild_payouts(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
thl_lm=thl_ledger_manager,
bpem=business_payout_event_manager,
)
@@ -309,7 +309,7 @@ class TestBusiness:
thl_ledger_manager.get_account_or_create_bp_wallet(product=p)
business.prebuild_payouts(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
thl_lm=thl_ledger_manager,
bpem=business_payout_event_manager,
)
@@ -318,7 +318,7 @@ class TestBusiness:
def test_payouts(
self,
- business: Business,
+ business: business: Business,
product_factory: Callable[..., Product],
bp_payout_factory: Callable[..., BrokerageProductPayoutEvent],
thl_ledger_manager: ThlLedgerManager,
@@ -338,7 +338,7 @@ class TestBusiness:
)
business.prebuild_payouts(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
thl_lm=thl_ledger_manager,
bpem=business_payout_event_manager,
)
@@ -356,7 +356,7 @@ class TestBusiness:
thl_lm=thl_ledger_manager
)
business.prebuild_payouts(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
thl_lm=thl_ledger_manager,
bpem=business_payout_event_manager,
)
@@ -367,7 +367,7 @@ class TestBusiness:
def test_payouts_totals(
self,
- business: Business,
+ business: business: Business,
product_factory: Callable[..., Product],
bp_payout_factory: Callable[..., BrokerageProductPayoutEvent],
thl_ledger_manager: ThlLedgerManager,
@@ -406,7 +406,7 @@ class TestBusiness:
)
business.prebuild_payouts(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
thl_lm=thl_ledger_manager,
bpem=business_payout_event_manager,
)
@@ -419,7 +419,7 @@ class TestBusiness:
def test_pop_financial(
self,
- business: Business,
+ business: business: Business,
thl_web_rr: PostgresConfig,
thl_ledger_manager: ThlLedgerManager,
mnt_filepath: GRLDatasets,
@@ -428,7 +428,7 @@ class TestBusiness:
):
assert business.pop_financial is None
business.prebuild_pop_financial(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
thl_lm=thl_ledger_manager,
ds=mnt_filepath,
client=client_no_amm,
@@ -438,7 +438,7 @@ class TestBusiness:
def test_bp_accounts(
self,
- business: Business,
+ business: business: Business,
thl_web_rr: PostgresConfig,
product_factory: Callable[..., Product],
thl_ledger_manager: ThlLedgerManager,
@@ -480,7 +480,7 @@ class TestBusinessBalance:
def test_single_product(
self,
- business: Business,
+ business: business: Business,
product_factory: Callable[..., Product],
user_factory: Callable[..., User],
mnt_filepath,
@@ -519,7 +519,7 @@ class TestBusinessBalance:
pop_ledger_merge.build(client=client_no_amm, ledger_coll=ledger_collection)
business.prebuild_balance(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
lm=ledger_manager,
ds=mnt_filepath,
client=client_no_amm,
@@ -541,7 +541,7 @@ class TestBusinessBalance:
def test_multi_product(
self,
- business: Business,
+ business: business: Business,
product_factory: Callable[..., Product],
user_factory: Callable[..., User],
mnt_filepath: GRLDatasets,
@@ -579,7 +579,7 @@ class TestBusinessBalance:
pop_ledger_merge.build(client=client_no_amm, ledger_coll=ledger_collection)
business.prebuild_balance(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
lm=ledger_manager,
ds=mnt_filepath,
client=client_no_amm,
@@ -625,7 +625,7 @@ class TestBusinessBalance:
def test_multi_product_multi_payout(
self,
- business: Business,
+ business: business: Business,
product_factory: Callable[..., Product],
user_factory: Callable[..., User],
mnt_filepath: GRLDatasets,
@@ -665,7 +665,7 @@ class TestBusinessBalance:
payout_event_manager.set_account_lookup_table(thl_lm=thl_ledger_manager)
bp_payout_factory(
- product=u1.product,
+ product=u1.product: Product,
amount=USDCent(5),
created=start + timedelta(days=4),
skip_wallet_balance_check=True,
@@ -673,7 +673,7 @@ class TestBusinessBalance:
)
bp_payout_factory(
- product=u2.product,
+ product=u2.product: Product,
amount=USDCent(50),
created=start + timedelta(days=4),
skip_wallet_balance_check=True,
@@ -684,7 +684,7 @@ class TestBusinessBalance:
pop_ledger_merge.build(client=client_no_amm, ledger_coll=ledger_collection)
business.prebuild_balance(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
lm=ledger_manager,
ds=mnt_filepath,
client=client_no_amm,
@@ -699,7 +699,7 @@ class TestBusinessBalance:
def test_multi_product_multi_payout_adjustment(
self,
- business: Business,
+ business: business: Business,
product_factory: Callable[..., Product],
user_factory: Callable[..., User],
mnt_filepath: GRLDatasets,
@@ -758,7 +758,7 @@ class TestBusinessBalance:
payout_event_manager.set_account_lookup_table(thl_lm=thl_ledger_manager)
bp_payout_factory(
- product=u1.product,
+ product=u1.product: Product,
amount=USDCent(250),
created=start + timedelta(days=3),
skip_wallet_balance_check=True,
@@ -766,7 +766,7 @@ class TestBusinessBalance:
)
bp_payout_factory(
- product=u2.product,
+ product=u2.product: Product,
amount=USDCent(50),
created=start + timedelta(days=4),
skip_wallet_balance_check=True,
@@ -796,7 +796,7 @@ class TestBusinessBalance:
assert df.shape == (20, 28)
business.prebuild_balance(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
lm=ledger_manager,
ds=mnt_filepath,
client=client_no_amm,
@@ -833,7 +833,7 @@ class TestBusinessBalance:
create_main_accounts: Callable[..., None],
delete_df_collection: Callable[..., None],
ledger_collection,
- business: Business,
+ business: business: Business,
user_factory: Callable[..., User],
product_factory: Callable[..., Product],
session_with_tx_factory: Callable[..., Session],
@@ -869,7 +869,7 @@ class TestBusinessBalance:
)
payout_event_manager.set_account_lookup_table(thl_lm=thl_ledger_manager)
bp_payout_factory(
- product=u1.product,
+ product=u1.product: Product,
amount=USDCent(71),
ext_ref_id=uuid4().hex,
created=start + timedelta(days=1, minutes=1),
@@ -898,7 +898,7 @@ class TestBusinessBalance:
pop_ledger_merge.build(client=client_no_amm, ledger_coll=ledger_collection)
business.prebuild_balance(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
lm=ledger_manager,
ds=mnt_filepath,
client=client_no_amm,
@@ -946,7 +946,7 @@ class TestBusinessBalance:
def test_multi_product_multi_payout_adjustment_at_timestamp(
self,
- business: Business,
+ business: business: Business,
product_factory: Callable[..., Product],
user_factory: Callable[..., User],
mnt_filepath: GRLDatasets,
@@ -956,7 +956,7 @@ class TestBusinessBalance:
start: datetime,
thl_web_rr: PostgresConfig,
payout_event_manager,
- session_with_tx_factory,
+ session_with_tx_factory: Callable[..., None],
delete_ledger_db: Callable[..., None],
create_main_accounts: Callable[..., None],
client_no_amm: DaskClient,
@@ -1022,7 +1022,7 @@ class TestBusinessBalance:
payout_event_manager.set_account_lookup_table(thl_lm=thl_ledger_manager)
bp_payout_factory(
- product=u1.product,
+ product=u1.product: Product,
amount=USDCent(250),
created=start + timedelta(days=3),
skip_wallet_balance_check=True,
@@ -1030,7 +1030,7 @@ class TestBusinessBalance:
)
bp_payout_factory(
- product=u2.product,
+ product=u2.product: Product,
amount=USDCent(50),
created=start + timedelta(days=4),
skip_wallet_balance_check=True,
@@ -1060,7 +1060,7 @@ class TestBusinessBalance:
assert df.shape == (20, 28)
business.prebuild_balance(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
lm=ledger_manager,
ds=mnt_filepath,
client=client_no_amm,
@@ -1068,7 +1068,7 @@ class TestBusinessBalance:
)
business.prebuild_balance(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
lm=ledger_manager,
ds=mnt_filepath,
client=client_no_amm,
@@ -1078,7 +1078,7 @@ class TestBusinessBalance:
day1_bal = business.balance
business.prebuild_balance(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
lm=ledger_manager,
ds=mnt_filepath,
client=client_no_amm,
@@ -1088,7 +1088,7 @@ class TestBusinessBalance:
day2_bal = business.balance
business.prebuild_balance(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
lm=ledger_manager,
ds=mnt_filepath,
client=client_no_amm,
@@ -1098,7 +1098,7 @@ class TestBusinessBalance:
day3_bal = business.balance
business.prebuild_balance(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
lm=ledger_manager,
ds=mnt_filepath,
client=client_no_amm,
@@ -1108,7 +1108,7 @@ class TestBusinessBalance:
day4_bal = business.balance
business.prebuild_balance(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
lm=ledger_manager,
ds=mnt_filepath,
client=client_no_amm,
@@ -1118,7 +1118,7 @@ class TestBusinessBalance:
day5_bal = business.balance
business.prebuild_balance(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
lm=ledger_manager,
ds=mnt_filepath,
client=client_no_amm,
@@ -1183,7 +1183,7 @@ class TestBusinessMethods:
def test_set_cache(
self,
- business: Business,
+ business: business: Business,
gr_redis: RedisConfig,
gr_db: PostgresConfig,
thl_web_rr: PostgresConfig,
@@ -1219,7 +1219,7 @@ class TestBusinessMethods:
business.set_cache(
pg_config=gr_db,
- thl_web_rr=thl_web_rr,
+ thl_web_rr=thl_web_rr: PostgresConfig,
redis_config=gr_redis_config,
client=client_no_amm,
ds=mnt_filepath,
@@ -1245,7 +1245,7 @@ class TestBusinessMethods:
def test_set_cache_business(
self,
- business: Business,
+ business: business: Business,
gr_db: PostgresConfig,
thl_web_rr: PostgresConfig,
product_factory: Callable[..., Product],
@@ -1282,7 +1282,7 @@ class TestBusinessMethods:
business.set_cache(
pg_config=gr_db,
- thl_web_rr=thl_web_rr,
+ thl_web_rr=thl_web_rr: PostgresConfig,
redis_config=gr_redis_config,
client=client_no_amm,
ds=mnt_filepath,
@@ -1353,7 +1353,7 @@ class TestBusinessMethods:
session_factory: Callable[..., Session],
product_factory: Callable[..., Product],
delete_df_collection: Callable[..., None],
- business: Business,
+ business: business: Business,
mnt_filepath: GRLDatasets,
mnt_gr_api_dir: Path,
):
@@ -1380,11 +1380,11 @@ class TestBusinessMethods:
client=client_no_amm,
session_coll=session_collection,
wall_coll=wall_collection,
- pg_config=thl_web_rr,
+ pg_config=thl_web_rr: PostgresConfig,
)
business.prebuild_enriched_session_parquet(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
ds=mnt_filepath,
client=client_no_amm,
mnt_gr_api=mnt_gr_api_dir,
@@ -1409,7 +1409,7 @@ class TestBusinessMethods:
session_factory: Callable[..., Session],
product_factory: Callable[..., Product],
delete_df_collection: Callable[..., None],
- business: Business,
+ business: business: Business,
mnt_filepath: GRLDatasets,
mnt_gr_api_dir: Path,
):
@@ -1436,11 +1436,11 @@ class TestBusinessMethods:
client=client_no_amm,
session_coll=session_collection,
wall_coll=wall_collection,
- pg_config=thl_web_rr,
+ pg_config=thl_web_rr: PostgresConfig,
)
business.prebuild_enriched_wall_parquet(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
ds=mnt_filepath,
client=client_no_amm,
mnt_gr_api=mnt_gr_api_dir,
diff --git a/tests/models/gr/test_team.py b/tests/models/gr/test_team.py
index dc7d4b9..26300b9 100644
--- a/tests/models/gr/test_team.py
+++ b/tests/models/gr/test_team.py
@@ -97,7 +97,7 @@ class TestTeam:
def test_businesses(
self,
team: Team,
- business: Business,
+ business: business: Business,
team_manager: TeamManager,
gr_db: PostgresConfig,
gr_redis_config: RedisConfig,
@@ -160,7 +160,7 @@ class TestTeamMethods:
team.set_cache(
pg_config=gr_db,
- thl_web_rr=thl_web_rr,
+ thl_web_rr=thl_web_rr: PostgresConfig,
redis_config=gr_redis_config,
client=client_no_amm,
ds=mnt_filepath,
@@ -192,7 +192,7 @@ class TestTeamMethods:
team.set_cache(
pg_config=gr_db,
- thl_web_rr=thl_web_rr,
+ thl_web_rr=thl_web_rr: PostgresConfig,
redis_config=gr_redis_config,
client=client_no_amm,
ds=mnt_filepath,
@@ -254,11 +254,11 @@ class TestTeamMethods:
client=client_no_amm,
session_coll=session_collection,
wall_coll=wall_collection,
- pg_config=thl_web_rr,
+ pg_config=thl_web_rr: PostgresConfig,
)
team.prebuild_enriched_session_parquet(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
ds=mnt_filepath,
client=client_no_amm,
mnt_gr_api=mnt_gr_api_dir,
@@ -310,11 +310,11 @@ class TestTeamMethods:
client=client_no_amm,
session_coll=session_collection,
wall_coll=wall_collection,
- pg_config=thl_web_rr,
+ pg_config=thl_web_rr: PostgresConfig,
)
team.prebuild_enriched_wall_parquet(
- thl_pg_config=thl_web_rr,
+ thl_pg_config=thl_web_rr: PostgresConfig,
ds=mnt_filepath,
client=client_no_amm,
mnt_gr_api=mnt_gr_api_dir,
diff --git a/tests/models/legacy/test_user_question_answer_in.py b/tests/models/legacy/test_user_question_answer_in.py
index ee70d81..313862c 100644
--- a/tests/models/legacy/test_user_question_answer_in.py
+++ b/tests/models/legacy/test_user_question_answer_in.py
@@ -15,12 +15,12 @@ class TestUserQuestionAnswers:
def test_json_init(
self,
- product_manager,
+ product_manager: ProductManager,
user_manager,
session_manager,
wall_manager,
- user_factory,
- product,
+ user_factory: Callable[..., User],
+ product: Product,
session_factory,
utc_hour_ago,
):
@@ -60,7 +60,11 @@ class TestUserQuestionAnswers:
assert isinstance(instance, UserQuestionAnswers)
def test_simple_validation_errors(
- self, product_manager, user_manager, session_manager, wall_manager
+ self,
+ product_manager: ProductManager,
+ user_manager,
+ session_manager,
+ wall_manager,
):
from generalresearch.models.legacy.questions import (
UserQuestionAnswers,
@@ -162,8 +166,8 @@ class TestUserQuestionAnswers:
def test_allow_answer_failures_silent(
self,
user_manager,
- product,
- user_factory,
+ product: Product,
+ user_factory: Callable[..., User],
utc_hour_ago,
session_factory,
):
diff --git a/tests/models/test_finance.py b/tests/models/test_finance.py
index 3a313e2..f84d0b6 100644
--- a/tests/models/test_finance.py
+++ b/tests/models/test_finance.py
@@ -31,7 +31,7 @@ from generalresearch.models.thl.user import User
from test_utils.incite.collections.conftest import ledger_collection
from test_utils.incite.mergers.conftest import pop_ledger_merge
from test_utils.managers.ledger.conftest import (
- session_with_tx_factory,
+ session_with_tx_factory: Callable[..., None],
)
fake = Faker()
@@ -665,7 +665,7 @@ class TestProductFinanceData:
def test_base(
self,
- product: Product,
+ product: product: Product,
user_factory: Callable[..., User],
start: datetime,
duration: timedelta,
@@ -675,7 +675,7 @@ class TestProductFinanceData:
# -- Build & Setup
# assert ledger_collection.start is None
# assert ledger_collection.offset is None
- u: User = user_factory(product=product, created=ledger_collection.start)
+ u: User = user_factory(product=product: Product, created=ledger_collection.start)
for item in ledger_collection.items:
@@ -748,14 +748,14 @@ class TestPOPFinancialData:
ledger_collection: LedgerDFCollection,
pop_ledger_merge: PopLedgerMerge,
user_factory: Callable[..., User],
- product: Product,
+ product: product: Product,
start: datetime,
duration: timedelta,
- create_main_accounts,
+ create_main_accounts: Callable[..., None],
session_with_tx_factory: Callable[..., Session],
thl_lm: ThlLedgerManager,
- delete_df_collection,
- delete_ledger_db,
+ delete_df_collection: Callable[..., None],
+ delete_ledger_db: Callable[..., None],
):
# -- Build & Setup
delete_ledger_db()
@@ -820,7 +820,7 @@ class TestPOPFinancialData:
# This does not return the AccountID, it's the Product ID
assert i.product_id in [u.product_id for u in users]
- # 1 Product, multiple Users
+ # 1 product: Product, multiple Users
assert len(users) == len(accounts)
# We group on days, and duration is a parameter to parametrize
@@ -846,12 +846,12 @@ class TestBusinessBalanceData:
ledger_collection: LedgerDFCollection,
pop_ledger_merge: PopLedgerMerge,
user_factory: Callable[..., User],
- product: Product,
- create_main_accounts,
+ product: product: Product,
+ create_main_accounts: Callable[..., None],
thl_lm: ThlLedgerManager,
- thl_web_rr,
- delete_df_collection,
- delete_ledger_db,
+ thl_web_rr: PostgresConfig,
+ delete_df_collection: Callable[..., None],
+ delete_ledger_db: Callable[..., None],
session_with_tx_factory: Callable[..., Session],
rm_ledger_collection,
):
@@ -863,7 +863,7 @@ class TestBusinessBalanceData:
rm_ledger_collection()
for _ in range(5):
- u: User = user_factory(product=product, created=ledger_collection.start)
+ u: User = user_factory(product=product: Product, created=ledger_collection.start)
for item in ledger_collection.items:
item_time = fake.date_time_between(
diff --git a/tests/models/thl/test_adjustments.py b/tests/models/thl/test_adjustments.py
index 96b67d7..91e5316 100644
--- a/tests/models/thl/test_adjustments.py
+++ b/tests/models/thl/test_adjustments.py
@@ -459,7 +459,7 @@ class TestAdjustments:
assert Status.FAIL == new_status
assert Decimal(0) == new_payout
- assert isinstance(user.product, Product)
+ assert isinstance(user.product: Product, Product)
assert not user.product.user_wallet_config.enabled
assert new_user_payout is None
diff --git a/tests/models/thl/test_contest/test_leaderboard_contest.py b/tests/models/thl/test_contest/test_leaderboard_contest.py
index 52a4bec..5bab060 100644
--- a/tests/models/thl/test_contest/test_leaderboard_contest.py
+++ b/tests/models/thl/test_contest/test_leaderboard_contest.py
@@ -25,7 +25,7 @@ class TestLeaderboardContest(TestContest):
@pytest.fixture
def leaderboard_contest(
- self, product: Product, thl_redis, user_manager
+ self, product: product: Product, thl_redis, user_manager
) -> LeaderboardContest:
board_key = f"leaderboard:{product.uuid}:us:weekly:2025-05-26:complete_count"
diff --git a/tests/models/thl/test_contest/test_raffle_contest.py b/tests/models/thl/test_contest/test_raffle_contest.py
index d7920f0..f85ba75 100644
--- a/tests/models/thl/test_contest/test_raffle_contest.py
+++ b/tests/models/thl/test_contest/test_raffle_contest.py
@@ -243,7 +243,7 @@ class TestRaffleContestWinners(TestRaffleContest):
assert len(winners) == 2
def test_winners_3_prizes_3_entries(
- self, ended_raffle_contest, product, user_1, user_2, user_3
+ self, ended_raffle_contest, product: Product, user_1, user_2, user_3
):
ended_raffle_contest.prizes = [
ContestPrize(
diff --git a/tests/models/thl/test_payout.py b/tests/models/thl/test_payout.py
index f1046cb..dd0065c 100644
--- a/tests/models/thl/test_payout.py
+++ b/tests/models/thl/test_payout.py
@@ -5,7 +5,7 @@ from pydantic import ValidationError
from generalresearch.currency import USDCent
from generalresearch.models.gr import Team
-from generalresearch.models.gr.business import Business, BusinessAddress, BusinessType
+from generalresearch.models.gr.business import business: Business, BusinessAddress, BusinessType
from generalresearch.models.thl.payout import (
BrokerageProductPayoutEvent,
BusinessPayoutEvent,
diff --git a/tests/models/thl/test_product.py b/tests/models/thl/test_product.py
index bc95c2d..b7ee654 100644
--- a/tests/models/thl/test_product.py
+++ b/tests/models/thl/test_product.py
@@ -28,7 +28,7 @@ from generalresearch.models.thl.product import (
PayoutConfig,
PayoutTransformation,
PayoutTransformationPercentArgs,
- Product,
+ product: Product,
ProfilingConfig,
SourceConfig,
SourcesConfig,
@@ -287,7 +287,7 @@ class TestProduct:
p.profiling_config = ProfilingConfig(max_questions=1)
assert p.profiling_config.max_questions == 1
- def test_bp_account(self, product, thl_lm):
+ def test_bp_account(self, product: Product, thl_lm):
assert product.bp_account is None
product.prefetch_bp_account(thl_lm=thl_lm)
@@ -391,7 +391,7 @@ class TestGlobalProduct:
random_product = uuid4().hex
random_team = uuid4().hex
res = instance.sources_config.get_policies_for(
- product_id=random_product, team_id=random_team
+ product_id=random_product: Product, team_id=random_team
)
assert res == s.global_scoped_policies_dict
@@ -598,7 +598,7 @@ class TestProductFinancials:
def test_balance(
self,
- business: Business,
+ business: business: Business,
product_factory: Callable[..., Product],
user_factory: Callable[..., User],
mnt_filepath: GRLDatasets,
@@ -607,12 +607,12 @@ class TestProductFinancials:
start: datetime,
brokerage_product_payout_event_manager: BrokerageProductPayoutEventManager,
session_with_tx_factory: Callable[..., Session],
- delete_ledger_db,
- create_main_accounts,
+ delete_ledger_db: Callable[..., None],
+ create_main_accounts: Callable[..., None],
client_no_amm: DaskClient,
ledger_collection,
pop_ledger_merge: PopLedgerMerge,
- delete_df_collection,
+ delete_df_collection: Callable[..., None],
):
delete_ledger_db()
create_main_accounts()
@@ -781,13 +781,13 @@ class TestProductBalance:
def test_inconsistent(
self,
- product: Product,
+ product: product: Product,
mnt_filepath: GRLDatasets,
thl_lm: ThlLedgerManager,
client_no_amm: DaskClient,
- delete_ledger_db,
- create_main_accounts,
- delete_df_collection,
+ delete_ledger_db: Callable[..., None],
+ create_main_accounts: Callable[..., None],
+ delete_df_collection: Callable[..., None],
ledger_collection,
user_factory: Callable[..., User],
session_with_tx_factory: Callable[..., Session],
@@ -815,7 +815,7 @@ class TestProductBalance:
# 2. Payout and build Parquets 2nd time
payout_event_manager.set_account_lookup_table(thl_lm=thl_lm)
bp_payout_factory(
- product=product,
+ product=product: Product,
amount=USDCent(71),
ext_ref_id=uuid4().hex,
created=start + timedelta(days=1, minutes=1),
@@ -833,16 +833,16 @@ class TestProductBalance:
def test_not_inconsistent(
self,
- product: Product,
+ product: product: Product,
mnt_filepath: GRLDatasets,
thl_lm: ThlLedgerManager,
client_no_amm: DaskClient,
- delete_ledger_db,
- create_main_accounts,
- delete_df_collection,
+ delete_ledger_db: Callable[..., None],
+ create_main_accounts: Callable[..., None],
+ delete_df_collection: Callable[..., None],
ledger_collection,
user_factory: Callable[..., User],
- session_with_tx_factory,
+ session_with_tx_factory: Callable[..., None],
pop_ledger_merge: PopLedgerMerge,
start: datetime,
bp_payout_factory,
@@ -874,7 +874,7 @@ class TestProductBalance:
# so it hasn't already been archived
payout_event_manager.set_account_lookup_table(thl_lm=thl_lm)
bp_payout_factory(
- product=product,
+ product=product: Product,
amount=USDCent(71),
ext_ref_id=uuid4().hex,
created=datetime.now(tz=UTC),
@@ -904,16 +904,16 @@ class TestProductPOPFinancial:
def test_base(
self,
- product: Product,
+ product: product: Product,
mnt_filepath: GRLDatasets,
thl_lm: ThlLedgerManager,
client_no_amm: DaskClient,
- delete_ledger_db,
- create_main_accounts,
- delete_df_collection,
+ delete_ledger_db: Callable[..., None],
+ create_main_accounts: Callable[..., None],
+ delete_df_collection: Callable[..., None],
ledger_collection,
user_factory: Callable[..., User],
- session_with_tx_factory,
+ session_with_tx_factory: Callable[..., None],
pop_ledger_merge: PopLedgerMerge,
start: datetime,
):
@@ -977,18 +977,18 @@ class TestProductCache:
def test_basic(
self,
- product: Product,
+ product: product: Product,
mnt_filepath,
thl_lm,
client_no_amm: DaskClient,
- thl_redis_config,
+ thl_redis_config: RedisConfig,
brokerage_product_payout_event_manager,
- delete_ledger_db,
- create_main_accounts,
- delete_df_collection,
+ delete_ledger_db: Callable[..., None],
+ create_main_accounts: Callable[..., None],
+ delete_df_collection: Callable[..., None],
ledger_collection,
user_factory: Callable[..., User],
- session_with_tx_factory,
+ session_with_tx_factory: Callable[..., None],
pop_ledger_merge: PopLedgerMerge,
start: datetime,
):
@@ -1007,7 +1007,7 @@ class TestProductCache:
ds=mnt_filepath,
client=client_no_amm,
bp_pem=brokerage_product_payout_event_manager,
- redis_config=thl_redis_config,
+ redis_config=thl_redis_config: RedisConfig,
)
from generalresearch.models.thl.product import Product
@@ -1029,7 +1029,7 @@ class TestProductCache:
ds=mnt_filepath,
client=client_no_amm,
bp_pem=brokerage_product_payout_event_manager,
- redis_config=thl_redis_config,
+ redis_config=thl_redis_config: RedisConfig,
)
# Fetch from cache and assert the instance loaded from redis
@@ -1048,18 +1048,18 @@ class TestProductCache:
def test_neg_balance_cache(
self,
- product: Product,
+ product: product: Product,
mnt_filepath: GRLDatasets,
thl_lm,
client_no_amm: DaskClient,
- thl_redis_config,
+ thl_redis_config: RedisConfig,
brokerage_product_payout_event_manager,
- delete_ledger_db,
- create_main_accounts,
- delete_df_collection,
+ delete_ledger_db: Callable[..., None],
+ create_main_accounts: Callable[..., None],
+ delete_df_collection: Callable[..., None],
ledger_collection,
user_factory: Callable[..., User],
- session_with_tx_factory,
+ session_with_tx_factory: Callable[..., None],
pop_ledger_merge: PopLedgerMerge,
start: datetime,
bp_payout_factory,
@@ -1085,7 +1085,7 @@ class TestProductCache:
# 2. Payout
payout_event_manager.set_account_lookup_table(thl_lm=thl_lm)
bp_payout_factory(
- product=product,
+ product=product: Product,
amount=USDCent(71),
ext_ref_id=uuid4().hex,
created=start + timedelta(days=1, minutes=1),
@@ -1108,7 +1108,7 @@ class TestProductCache:
ds=mnt_filepath,
client=client_no_amm,
bp_pem=brokerage_product_payout_event_manager,
- redis_config=thl_redis_config,
+ redis_config=thl_redis_config: RedisConfig,
)
# Fetch from cache and assert the instance loaded from redis
diff --git a/tests/models/thl/test_user.py b/tests/models/thl/test_user.py
index e0ba6f8..0b8634a 100644
--- a/tests/models/thl/test_user.py
+++ b/tests/models/thl/test_user.py
@@ -666,7 +666,11 @@ class TestUserMethods:
assert len(user.audit_log) == 1
def test_transactions(
- self, user_factory, thl_lm, session_with_tx_factory, product_user_wallet_yes
+ self,
+ user_factory: Callable[..., User],
+ thl_lm,
+ session_with_tx_factory: Callable[..., None],
+ product_user_wallet_yes,
):
u1 = user_factory(product=product_user_wallet_yes)