mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
test: add test case for #11414
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# pragma pylint: disable=missing-docstring, protected-access, invalid-name
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from math import isnan, nan
|
||||
|
||||
import pytest
|
||||
from ccxt import (
|
||||
@@ -321,6 +322,7 @@ def test_amount_to_precision(
|
||||
(2.9977, TICK_SIZE, 0.005, 3.0, ROUND),
|
||||
(234.24, TICK_SIZE, 0.5, 234.0, ROUND),
|
||||
(234.26, TICK_SIZE, 0.5, 234.5, ROUND),
|
||||
(nan, TICK_SIZE, 3, nan, ROUND),
|
||||
# Tests for TRUNCATTE
|
||||
(2.34559, DECIMAL_PLACES, 4, 2.3455, TRUNCATE),
|
||||
(2.34559, DECIMAL_PLACES, 5, 2.34559, TRUNCATE),
|
||||
@@ -359,10 +361,11 @@ def test_amount_to_precision(
|
||||
],
|
||||
)
|
||||
def test_price_to_precision(price, precision_mode, precision, expected, rounding_mode):
|
||||
assert (
|
||||
price_to_precision(price, precision, precision_mode, rounding_mode=rounding_mode)
|
||||
== expected
|
||||
)
|
||||
result = price_to_precision(price, precision, precision_mode, rounding_mode=rounding_mode)
|
||||
if not isnan(expected):
|
||||
assert result == expected
|
||||
else:
|
||||
assert isnan(result)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
Reference in New Issue
Block a user