aboutsummaryrefslogtreecommitdiff
path: root/tests/models/thl
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/models/thl
parent5682f48a96b0713929a4bb52e72eec5907d5dd32 (diff)
downloadgeneralresearch-3b4059135be47f7752a08e4277a85f9e57ceaa9d.tar.gz
generalresearch-3b4059135be47f7752a08e4277a85f9e57ceaa9d.zip
Ruff typing from this morning. WIP
Diffstat (limited to 'tests/models/thl')
-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
6 files changed, 48 insertions, 44 deletions
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)