mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
test: add tests for N/A when formatting prices
This commit is contained in:
@@ -32,6 +32,7 @@ def test_fmt_coin():
|
|||||||
assert fmt_coin(0.1274512123, "BTC", False) == "0.12745121"
|
assert fmt_coin(0.1274512123, "BTC", False) == "0.12745121"
|
||||||
assert fmt_coin(0.1274512123, "ETH", False) == "0.12745"
|
assert fmt_coin(0.1274512123, "ETH", False) == "0.12745"
|
||||||
assert fmt_coin(222.2, "USDT", False, True) == "222.200"
|
assert fmt_coin(222.2, "USDT", False, True) == "222.200"
|
||||||
|
assert fmt_coin(float("nan"), "USDT", False, True) == "N/A"
|
||||||
|
|
||||||
|
|
||||||
def test_fmt_coin2():
|
def test_fmt_coin2():
|
||||||
@@ -42,6 +43,7 @@ def test_fmt_coin2():
|
|||||||
assert fmt_coin2(0.1274512123, "BTC") == "0.12745121 BTC"
|
assert fmt_coin2(0.1274512123, "BTC") == "0.12745121 BTC"
|
||||||
assert fmt_coin2(0.1274512123, "ETH") == "0.12745121 ETH"
|
assert fmt_coin2(0.1274512123, "ETH") == "0.12745121 ETH"
|
||||||
assert fmt_coin2(0.00001245, "PEPE") == "0.00001245 PEPE"
|
assert fmt_coin2(0.00001245, "PEPE") == "0.00001245 PEPE"
|
||||||
|
assert fmt_coin2(float("nan"), "PEPE") == "N/A PEPE"
|
||||||
|
|
||||||
|
|
||||||
def test_round_value():
|
def test_round_value():
|
||||||
@@ -53,6 +55,8 @@ def test_round_value():
|
|||||||
assert round_value(0.1274512123, 5) == "0.12745"
|
assert round_value(0.1274512123, 5) == "0.12745"
|
||||||
assert round_value(222.2, 3, True) == "222.200"
|
assert round_value(222.2, 3, True) == "222.200"
|
||||||
assert round_value(222.2, 0, True) == "222"
|
assert round_value(222.2, 0, True) == "222"
|
||||||
|
assert round_value(float("nan"), 0, True) == "N/A"
|
||||||
|
assert round_value(float("nan"), 10, True) == "N/A"
|
||||||
|
|
||||||
|
|
||||||
def test_format_duration():
|
def test_format_duration():
|
||||||
|
|||||||
Reference in New Issue
Block a user