From 934bcf253eb4427ab8d372cb193e2346e49ca0ad Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 8 Dec 2024 08:30:55 +0100 Subject: [PATCH] test: add tests for list parsing --- tests/test_configuration.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_configuration.py b/tests/test_configuration.py index 8011ded96..3e9df382b 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -1481,6 +1481,12 @@ def test_flat_vars_to_nested_dict(caplog): "FREQTRADE__STAKE_AMOUNT": "200.05", "FREQTRADE__TELEGRAM__CHAT_ID": "2151", "NOT_RELEVANT": "200.0", # Will be ignored + "FREQTRADE__ARRAY": '[{"name":"default","host":"xxx"}]', + "FREQTRADE__EXCHANGE__PAIR_WHITELIST": '["BTC/USDT", "ETH/USDT"]', + # Fails due to trailing comma + "FREQTRADE__ARRAY_TRAIL_COMMA": '[{"name":"default","host":"xxx",}]', + # Object fails + "FREQTRADE__OBJECT": '{"name":"default","host":"xxx"}', } expected = { "stake_amount": 200.05, @@ -1494,8 +1500,12 @@ def test_flat_vars_to_nested_dict(caplog): }, "some_setting": True, "some_false_setting": False, + "pair_whitelist": ["BTC/USDT", "ETH/USDT"], }, "telegram": {"chat_id": "2151"}, + "array": [{"name": "default", "host": "xxx"}], + "object": '{"name":"default","host":"xxx"}', + "array_trail_comma": '[{"name":"default","host":"xxx",}]', } res = _flat_vars_to_nested_dict(test_args, ENV_VAR_PREFIX) assert res == expected