Skip to content

Commit 7b8f058

Browse files
committed
test: add test for order_type force behavior
1 parent 7ae8971 commit 7b8f058

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/optimize/test_lookahead_analysis.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,30 @@ def test_lookahead_helper_no_strategy_defined(lookahead_conf):
123123
LookaheadAnalysisSubFunctions.start(conf)
124124

125125

126-
def test_lookahead_helper_start(lookahead_conf, mocker) -> None:
126+
def test_lookahead_helper_start(lookahead_conf, mocker, caplog) -> None:
127127
single_mock = MagicMock()
128128
text_table_mock = MagicMock()
129129
mocker.patch.multiple(
130130
"freqtrade.optimize.analysis.lookahead_helpers.LookaheadAnalysisSubFunctions",
131131
initialize_single_lookahead_analysis=single_mock,
132132
text_table_lookahead_analysis_instances=text_table_mock,
133133
)
134-
LookaheadAnalysisSubFunctions.start(lookahead_conf)
134+
LookaheadAnalysisSubFunctions.start(deepcopy(lookahead_conf))
135135
assert single_mock.call_count == 1
136136
assert text_table_mock.call_count == 1
137+
assert log_has_re("Forced order_types to market orders.", caplog)
138+
assert single_mock.call_args_list[0][0][0]["order_types"]["entry"] == "market"
137139

138140
single_mock.reset_mock()
139141
text_table_mock.reset_mock()
140142

143+
lookahead_conf["lookahead_allow_limit_orders"] = True
144+
LookaheadAnalysisSubFunctions.start(lookahead_conf)
145+
assert single_mock.call_count == 1
146+
assert text_table_mock.call_count == 1
147+
assert log_has_re("Using configured order_types, skipping order_types override.", caplog)
148+
assert "order_types" not in single_mock.call_args_list[0][0][0]
149+
141150

142151
@pytest.mark.parametrize(
143152
"indicators, expected_caption_text",

0 commit comments

Comments
 (0)