from __future__ import annotations
from typing import TYPE_CHECKING, cast
from pytest import fixture, mark
from ....consts import FIELDS
from ....market import Market
from ....rule.manifold.user import ResolveToUserCreatedVolume, ResolveToUserProfit
from ... import manifold_vcr
if TYPE_CHECKING: # pragma: no cover
from pytest_regressions.data_regression import DataRegressionFixture
from ....consts import FieldType
from ... import PytestRequest
[docs]@fixture(params=["LivInTheLookingGlass", "v"])
def manifold_user(request: PytestRequest[str]) -> str:
return request.param
[docs]@fixture(params=FIELDS)
def field(request: PytestRequest[FieldType]) -> FieldType:
return request.param
[docs]@mark.depends(on=(
"ManifoldMarketManager/PyManifold/tests/test_pymanifold.py::test_get_user"
))
def test_user_profit(manifold_user: str, field: FieldType, data_regression: DataRegressionFixture) -> None:
with manifold_vcr.use_cassette(f'rule/manifold/test_user_profit/{manifold_user}/{field}.yaml'):
obj = ResolveToUserProfit(manifold_user, field)
val = obj._value(cast(Market, None))
data_regression.check({'answer': val})
[docs]@mark.depends(on=(
"ManifoldMarketManager/PyManifold/tests/test_pymanifold.py::test_get_user"
))
def test_user_market_volume(manifold_user: str, field: FieldType, data_regression: DataRegressionFixture) -> None:
with manifold_vcr.use_cassette(f'rule/manifold/test_user_volume/{manifold_user}/{field}.yaml'):
obj = ResolveToUserCreatedVolume(manifold_user, field)
val = obj._value(cast(Market, None))
data_regression.check({'answer': val})