테스트 강화 및 코드 품질 개선
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
import sys
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
|
||||
|
||||
import builtins
|
||||
import types
|
||||
import pandas as pd
|
||||
import pytest
|
||||
|
||||
import main
|
||||
from .test_helpers import check_and_notify, safe_send_telegram
|
||||
from .test_helpers import check_and_notify
|
||||
|
||||
|
||||
def test_compute_macd_hist_monkeypatch(monkeypatch):
|
||||
@@ -19,7 +15,8 @@ def test_compute_macd_hist_monkeypatch(monkeypatch):
|
||||
def fake_macd(series, fast, slow, signal):
|
||||
return dummy_macd
|
||||
|
||||
monkeypatch.setattr(main.ta, "macd", fake_macd)
|
||||
# 올바른 모듈 경로로 monkey patch
|
||||
monkeypatch.setattr("src.indicators.ta.macd", fake_macd)
|
||||
|
||||
close = pd.Series([1, 2, 3, 4])
|
||||
|
||||
@@ -61,7 +58,9 @@ def test_check_and_notify_positive_sends(monkeypatch):
|
||||
signal_values = [0.5] * len(close) # Constant signal line
|
||||
macd_df["MACD_12_26_9"] = pd.Series(macd_values, index=close.index)
|
||||
macd_df["MACDs_12_26_9"] = pd.Series(signal_values, index=close.index)
|
||||
macd_df["MACDh_12_26_9"] = pd.Series([v - s for v, s in zip(macd_values, signal_values)], index=close.index)
|
||||
macd_df["MACDh_12_26_9"] = pd.Series(
|
||||
[v - s for v, s in zip(macd_values, signal_values, strict=True)], index=close.index
|
||||
)
|
||||
return macd_df
|
||||
|
||||
monkeypatch.setattr(signals.ta, "macd", fake_macd)
|
||||
|
||||
Reference in New Issue
Block a user