19 lines
844 B
Python
19 lines
844 B
Python
import dataclasses
|
|
|
|
from fxhnt.application.allocation_policy import resolve_allocation_policy
|
|
from fxhnt.config import get_settings
|
|
|
|
|
|
def test_policy_none_matches_resolved_default(monkeypatch):
|
|
# record_allocation(policy=None) must build the SAME policy resolve_allocation_policy(get_settings())
|
|
# returns today. Assert via the helper the code will use: a None arg resolves to that same call.
|
|
from fxhnt.application import allocation_ingest as ai
|
|
resolved = ai._effective_policy(None) # helper introduced in Step 3
|
|
assert resolved == resolve_allocation_policy(get_settings())
|
|
|
|
|
|
def test_policy_passthrough():
|
|
from fxhnt.application import allocation_ingest as ai
|
|
p = dataclasses.replace(resolve_allocation_policy(get_settings()), target_vol=0.20, kelly_fraction=0.5)
|
|
assert ai._effective_policy(p) is p
|