fix(CORE-001D3A): accept decimal boundary inputs
This commit is contained in:
@@ -30,8 +30,17 @@ class StringBoundaryConfig:
|
||||
margin_call_price = "193.33333333333334"
|
||||
|
||||
|
||||
def test_normalize_save_status_snapshot_coerces_numeric_boundary_values() -> None:
|
||||
snapshot = _normalize_save_status_snapshot(StringBoundaryConfig())
|
||||
class DecimalBoundaryConfig:
|
||||
entry_basis_mode = "weight"
|
||||
gold_value = Decimal("215000")
|
||||
entry_price = Decimal("215.0")
|
||||
gold_ounces = Decimal("1000")
|
||||
current_ltv = Decimal("0.6744186046511628")
|
||||
margin_call_price = Decimal("193.33333333333334")
|
||||
|
||||
|
||||
def test_normalize_save_status_snapshot_accepts_decimal_boundary_values() -> None:
|
||||
snapshot = _normalize_save_status_snapshot(DecimalBoundaryConfig())
|
||||
|
||||
assert snapshot.entry_basis_mode == "weight"
|
||||
assert snapshot.gold_value == Decimal("215000")
|
||||
@@ -41,6 +50,17 @@ def test_normalize_save_status_snapshot_coerces_numeric_boundary_values() -> Non
|
||||
assert snapshot.margin_call_price == Decimal("193.33333333333334")
|
||||
|
||||
|
||||
def test_save_status_text_accepts_string_boundary_values() -> None:
|
||||
status = save_status_text(StringBoundaryConfig())
|
||||
|
||||
assert "Saved: basis=weight" in status
|
||||
assert "start=$215,000" in status
|
||||
assert "entry=$215.00/oz" in status
|
||||
assert "weight=1,000.00 oz" in status
|
||||
assert "LTV=67.4%" in status
|
||||
assert "trigger=$193.33/oz" in status
|
||||
|
||||
|
||||
def test_normalize_save_status_snapshot_rejects_bool_values() -> None:
|
||||
class InvalidBoundaryConfig(StringBoundaryConfig):
|
||||
current_ltv = True
|
||||
|
||||
Reference in New Issue
Block a user