From 06b59551b018fd4b7d066505e71e2510cd3e3b4e Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 30 May 2021 20:07:57 +0200 Subject: [PATCH] Improve test coverage --- tests/test_configuration.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_configuration.py b/tests/test_configuration.py index b2c883108..c15a0fe6a 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -88,6 +88,18 @@ def test_load_config_file_error_range(default_conf, mocker, caplog) -> None: '"stake_amount": .001, "fiat_display_currency": "USD", ' '"timeframe": "5m", "dry_run": true, "cance') + filedata = json.dumps(default_conf, indent=2).replace( + '"stake_amount": 0.001,', '"stake_amount": .001,') + mocker.patch.object(Path, "read_text", MagicMock(return_value=filedata)) + + x = log_config_error_range('somefile', 'Parse error at offset 4: Invalid value.') + assert isinstance(x, str) + assert (x == ' "max_open_trades": 1,\n "stake_currency": "BTC",\n' + ' "stake_amount": .001,') + + x = log_config_error_range('-', '') + assert x == '' + def test__args_to_config(caplog):