From 649db69314486e3983f901d9f47222a008ce3b85 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 23 Nov 2025 08:30:24 +0100 Subject: [PATCH] test: add tests for N/A when formatting prices --- tests/util/test_formatters.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/util/test_formatters.py b/tests/util/test_formatters.py index 4a760961d..a884c0750 100644 --- a/tests/util/test_formatters.py +++ b/tests/util/test_formatters.py @@ -32,6 +32,7 @@ def test_fmt_coin(): assert fmt_coin(0.1274512123, "BTC", False) == "0.12745121" assert fmt_coin(0.1274512123, "ETH", False) == "0.12745" assert fmt_coin(222.2, "USDT", False, True) == "222.200" + assert fmt_coin(float("nan"), "USDT", False, True) == "N/A" 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, "ETH") == "0.12745121 ETH" assert fmt_coin2(0.00001245, "PEPE") == "0.00001245 PEPE" + assert fmt_coin2(float("nan"), "PEPE") == "N/A PEPE" def test_round_value(): @@ -53,6 +55,8 @@ def test_round_value(): assert round_value(0.1274512123, 5) == "0.12745" assert round_value(222.2, 3, True) == "222.200" 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():