diff --git a/tests/data.py b/tests/config.py similarity index 55% rename from tests/data.py rename to tests/config.py index d1df080..b4195ae 100644 --- a/tests/data.py +++ b/tests/config.py @@ -1,10 +1,17 @@ from pandas import read_csv -CORRELATION_THRESHOLD = 0.99 # Less than 0.99 is undesirable +VERBOSE = True + ALERT = f"[!]" INFO = f"[i]" -VERBOSE = True + +CORRELATION = 'corr' #'sem' +CORRELATION_THRESHOLD = 0.99 # Less than 0.99 is undesirable + sample_data = read_csv('data/sample.csv', index_col=0, parse_dates=True, infer_datetime_format=False, keep_date_col=True) -def error_analysis(df, kind, msg, icon=INFO): - if VERBOSE: print(f"\n {icon} {df.name}['{kind}']: {msg}") \ No newline at end of file +def error_analysis(df, kind, msg, icon=INFO, newline=True): + if VERBOSE: + s = f" {icon} {df.name}['{kind}']: {msg}" + if newline: s = '\n' + s + print(s) \ No newline at end of file diff --git a/tests/test_indicator_momentum.py b/tests/test_indicator_momentum.py index b87eacb..c05bd40 100644 --- a/tests/test_indicator_momentum.py +++ b/tests/test_indicator_momentum.py @@ -1,5 +1,5 @@ +from .config import error_analysis, sample_data, CORRELATION, CORRELATION_THRESHOLD, VERBOSE from .context import pandas_ta -from .data import sample_data, CORRELATION_THRESHOLD, VERBOSE from unittest import TestCase, skip import pandas.util.testing as pdt @@ -37,252 +37,239 @@ class TestMomentum(TestCase): def test_ao(self): - ao = self.momentum.ao(self.high, self.low) - self.assertIsInstance(ao, Series) - self.assertEqual(ao.name, 'AO_5_34') + result = self.momentum.ao(self.high, self.low) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'AO_5_34') def test_apo(self): - apo = self.momentum.apo(self.close) - self.assertIsInstance(apo, Series) - self.assertEqual(apo.name, 'APO_12_26') + result = self.momentum.apo(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'APO_12_26') try: - tal_apo = tal.APO(self.close, 12, 26) - pdt.assert_series_equal(apo, tal_apo, check_names=False) + expected = tal.APO(self.close, 12, 26) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(apo, tal_apo, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {apo.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_bop(self): - bop = self.momentum.bop(self.open, self.high, self.low, self.close) - self.assertIsInstance(bop, Series) - self.assertEqual(bop.name, 'BOP') + result = self.momentum.bop(self.open, self.high, self.low, self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'BOP') try: - tal_bop = tal.BOP(self.open, self.high, self.low, self.close) - pdt.assert_series_equal(bop, tal_bop, check_names=False) + expected = tal.BOP(self.open, self.high, self.low, self.close) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(bop, tal_bop, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {bop.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_cci(self): - cci = self.momentum.cci(self.high, self.low, self.close) - self.assertIsInstance(cci, Series) - self.assertEqual(cci.name, 'CCI_20_0.015') + result = self.momentum.cci(self.high, self.low, self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'CCI_20_0.015') try: - tal_cci = tal.CCI(self.high, self.low, self.close) - pdt.assert_series_equal(cci, tal_cci, check_names=False) + expected = tal.CCI(self.high, self.low, self.close) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(cci, tal_cci, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {cci.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_cmo(self): - cmo = self.momentum.cmo(self.close) - self.assertIsInstance(cmo, Series) - self.assertEqual(cmo.name, 'CMO_14') + result = self.momentum.cmo(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'CMO_14') try: - tal_cmo = tal.CMO(self.close) - pdt.assert_series_equal(cmo, tal_cmo, check_names=False) + expected = tal.CMO(self.close) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(cmo, tal_cmo, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {cmo.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_coppock(self): - coppock = self.momentum.coppock(self.close) - self.assertIsInstance(coppock, Series) - self.assertEqual(coppock.name, 'COPC_11_14_10') + result = self.momentum.coppock(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'COPC_11_14_10') def test_kst(self): - kst = self.momentum.kst(self.close) - self.assertIsInstance(kst, DataFrame) - self.assertEqual(kst.name, 'KST_10_15_20_30_10_10_10_15_9') + result = self.momentum.kst(self.close) + self.assertIsInstance(result, DataFrame) + self.assertEqual(result.name, 'KST_10_15_20_30_10_10_10_15_9') def test_macd(self): - macd = self.momentum.macd(self.close) - self.assertIsInstance(macd, DataFrame) - self.assertEqual(macd.name, 'MACD_12_26_9') + result = self.momentum.macd(self.close) + self.assertIsInstance(result, DataFrame) + self.assertEqual(result.name, 'MACD_12_26_9') try: - tal_macd = tal.MACD(self.close) - tal_macddf = DataFrame({'MACD_12_26_9': tal_macd[0], 'MACDH_12_26_9': tal_macd[2], 'MACDS_12_26_9': tal_macd[1]}) - pdt.assert_frame_equal(macd, tal_macddf) + expected = tal.MACD(self.close) + expecteddf = DataFrame({'MACD_12_26_9': expected[0], 'MACDH_12_26_9': expected[2], 'MACDS_12_26_9': expected[1]}) + pdt.assert_frame_equal(result, expecteddf) except AssertionError as ae: - col = 'corr' try: - macd_corr = pandas_ta.utils.df_error_analysis(macd.iloc[:,0], tal_macddf.iloc[:,0], col=col) + macd_corr = pandas_ta.utils.df_error_analysis(result.iloc[:,0], expecteddf.iloc[:,0], col=CORRELATION) self.assertGreater(macd_corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {macd.iloc[:,0].name}['{col}']: {ex}") + error_analysis(result.iloc[:,0], CORRELATION, ex) try: - history_corr = pandas_ta.utils.df_error_analysis(macd.iloc[:,1], tal_macddf.iloc[:,1], col=col) + history_corr = pandas_ta.utils.df_error_analysis(result.iloc[:,1], expecteddf.iloc[:,1], col=CORRELATION) self.assertGreater(history_corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {macd.iloc[:,1].name}['{col}']: {ex}") + error_analysis(result.iloc[:,1], CORRELATION, ex, newline=False) try: - signal_corr = pandas_ta.utils.df_error_analysis(macd.iloc[:,2], tal_macddf.iloc[:,2], col=col) + signal_corr = pandas_ta.utils.df_error_analysis(result.iloc[:,2], expecteddf.iloc[:,2], col=CORRELATION) self.assertGreater(signal_corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {macd.iloc[:,2].name}['{col}']: {ex}") + error_analysis(result.iloc[:,2], CORRELATION, ex, newline=False) def test_mom(self): - mom = self.momentum.mom(self.close) - self.assertIsInstance(mom, Series) - self.assertEqual(mom.name, 'MOM_10') + result = self.momentum.mom(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'MOM_10') try: - tal_mom = tal.MOM(self.close) - pdt.assert_series_equal(mom, tal_mom, check_names=False) + expected = tal.MOM(self.close) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(mom, tal_mom, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {mom.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_ppo(self): - ppo = self.momentum.ppo(self.close) - self.assertIsInstance(ppo, DataFrame) - self.assertEqual(ppo.name, 'PPO_12_26_9') + result = self.momentum.ppo(self.close) + self.assertIsInstance(result, DataFrame) + self.assertEqual(result.name, 'PPO_12_26_9') try: - tal_ppo = tal.PPO(self.close) - pdt.assert_series_equal(ppo['PPO_12_26_9'], tal_ppo, check_names=False) + expected = tal.PPO(self.close) + pdt.assert_series_equal(result['PPO_12_26_9'], expected, check_names=False) except AssertionError as ae: try: - col='corr' - corr = pandas_ta.utils.df_error_analysis(ppo['PPO_12_26_9'], tal_ppo, col=col) + corr = pandas_ta.utils.df_error_analysis(result['PPO_12_26_9'], expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {ppo['PPO_12_26_9'].name}['{col}']: {ex}") + error_analysis(result['PPO_12_26_9'], CORRELATION, ex) def test_roc(self): - roc = self.momentum.roc(self.close) - self.assertIsInstance(roc, Series) - self.assertEqual(roc.name, 'ROC_10') + result = self.momentum.roc(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'ROC_10') try: - tal_roc = tal.ROC(self.close) - pdt.assert_series_equal(roc, tal_roc, check_names=False) + expected = tal.ROC(self.close) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col='corr' - corr = pandas_ta.utils.df_error_analysis(roc, tal_roc, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {roc.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_rsi(self): - rsi = self.momentum.rsi(self.close) - self.assertIsInstance(rsi, Series) - self.assertEqual(rsi.name, 'RSI_14') + result = self.momentum.rsi(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'RSI_14') try: - tal_rsi = tal.RSI(self.close) - pdt.assert_series_equal(rsi, tal_rsi, check_names=False) + expected = tal.RSI(self.close) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col='corr' - corr = pandas_ta.utils.df_error_analysis(rsi, tal_rsi, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {rsi.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_stoch(self): - stoch = self.momentum.stoch(self.high, self.low, self.close) - self.assertIsInstance(stoch, DataFrame) - self.assertEqual(stoch.name, 'STOCH_14_5_3') + result = self.momentum.stoch(self.high, self.low, self.close) + self.assertIsInstance(result, DataFrame) + self.assertEqual(result.name, 'STOCH_14_5_3') try: tal_stochf = tal.STOCHF(self.high, self.low, self.close) tal_stoch = tal.STOCH(self.high, self.low, self.close) tal_stochdf = DataFrame({'STOCHF_14': tal_stochf[0], 'STOCHF_3': tal_stochf[1], 'STOCH_5': tal_stoch[0], 'STOCH_3': tal_stoch[1]}) - pdt.assert_frame_equal(stoch, tal_stochdf) + pdt.assert_frame_equal(result, tal_stochdf) except AssertionError as ae: - col='corr' try: - col='corr' - stochfk_corr = pandas_ta.utils.df_error_analysis(stoch.iloc[:,0], tal_stochdf.iloc[:,0], col=col) + stochfk_corr = pandas_ta.utils.df_error_analysis(result.iloc[:,0], tal_stochdf.iloc[:,0], col=CORRELATION) self.assertGreater(stochfk_corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {stoch.iloc[:,0].name}['{col}']: {ex}") + error_analysis(result.iloc[:,0], CORRELATION, ex) try: - stochfd_corr = pandas_ta.utils.df_error_analysis(stoch.iloc[:,1], tal_stochdf.iloc[:,1], col=col) + stochfd_corr = pandas_ta.utils.df_error_analysis(result.iloc[:,1], tal_stochdf.iloc[:,1], col=CORRELATION) self.assertGreater(stochfd_corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f" [!] {stoch.iloc[:,1].name}['{col}']: {ex}") + error_analysis(result.iloc[:,1], CORRELATION, ex, newline=False) try: - stochsk_corr = pandas_ta.utils.df_error_analysis(stoch.iloc[:,2], tal_stochdf.iloc[:,2], col=col) + stochsk_corr = pandas_ta.utils.df_error_analysis(result.iloc[:,2], tal_stochdf.iloc[:,2], col=CORRELATION) self.assertGreater(stochsk_corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f" [!] {stoch.iloc[:,2].name}['{col}']: {ex}") + error_analysis(result.iloc[:,2], CORRELATION, ex, newline=False) try: - stochsd_corr = pandas_ta.utils.df_error_analysis(stoch.iloc[:,3], tal_stochdf.iloc[:,3], col=col) + stochsd_corr = pandas_ta.utils.df_error_analysis(result.iloc[:,3], tal_stochdf.iloc[:,3], col=CORRELATION) self.assertGreater(stochsd_corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f" [!] {stoch.iloc[:,3].name}['{col}']: {ex}") + error_analysis(result.iloc[:,3], CORRELATION, ex, newline=False) def test_trix(self): - trix = self.momentum.trix(self.close) - self.assertIsInstance(trix, Series) - self.assertEqual(trix.name, 'TRIX_30') + result = self.momentum.trix(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'TRIX_30') def test_tsi(self): - tsi = self.momentum.tsi(self.close) - self.assertIsInstance(tsi, Series) - self.assertEqual(tsi.name, 'TSI_13_25') + result = self.momentum.tsi(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'TSI_13_25') def test_uo(self): - uo = self.momentum.uo(self.high, self.low, self.close) - self.assertIsInstance(uo, Series) - self.assertEqual(uo.name, 'UO_7_14_28') + result = self.momentum.uo(self.high, self.low, self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'UO_7_14_28') try: - tal_uo = tal.ULTOSC(self.high, self.low, self.close) - pdt.assert_series_equal(uo, tal_uo, check_names=False) + expected = tal.ULTOSC(self.high, self.low, self.close) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col='corr' - corr = pandas_ta.utils.df_error_analysis(uo, tal_uo, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {uo.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_willr(self): - willr = self.momentum.willr(self.high, self.low, self.close) - self.assertIsInstance(willr, Series) - self.assertEqual(willr.name, 'WILLR_14') + result = self.momentum.willr(self.high, self.low, self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'WILLR_14') try: - tal_willr = tal.WILLR(self.high, self.low, self.close) - pdt.assert_series_equal(willr, tal_willr, check_names=False) + expected = tal.WILLR(self.high, self.low, self.close) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col='corr' - corr = pandas_ta.utils.df_error_analysis(willr, tal_willr, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {willr.name}['{col}']: {ex}") \ No newline at end of file + error_analysis(result, CORRELATION, ex) \ No newline at end of file diff --git a/tests/test_indicator_momentum_ext.py b/tests/test_indicator_momentum_ext.py index a06ae1f..d0c2e91 100644 --- a/tests/test_indicator_momentum_ext.py +++ b/tests/test_indicator_momentum_ext.py @@ -1,5 +1,5 @@ +from .config import sample_data from .context import pandas_ta -from .data import sample_data from unittest import TestCase from pandas import DataFrame diff --git a/tests/test_indicator_overlap.py b/tests/test_indicator_overlap.py index 0cc562c..635cfa7 100644 --- a/tests/test_indicator_overlap.py +++ b/tests/test_indicator_overlap.py @@ -1,5 +1,5 @@ +from .config import error_analysis, sample_data, CORRELATION, CORRELATION_THRESHOLD, VERBOSE from .context import pandas_ta -from .data import sample_data, CORRELATION_THRESHOLD, VERBOSE from unittest import TestCase import pandas.util.testing as pdt @@ -37,67 +37,64 @@ class TestOverlap(TestCase): def test_dema(self): - dema = self.overlap.dema(self.close) - self.assertIsInstance(dema, Series) - self.assertEqual(dema.name, 'DEMA_10') + result = self.overlap.dema(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'DEMA_10') try: - tal_dema = tal.DEMA(self.close, 10) - pdt.assert_series_equal(dema, tal_dema, check_names=False) + expected = tal.DEMA(self.close, 10) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col='corr' - corr = pandas_ta.utils.df_error_analysis(dema, tal_dema, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {dema.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_ema(self): - ema = self.overlap.ema(self.close, presma=False) - self.assertIsInstance(ema, Series) - self.assertEqual(ema.name, 'EMA_10') + result = self.overlap.ema(self.close, presma=False) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'EMA_10') try: - tal_ema = tal.EMA(self.close, 10) - pdt.assert_series_equal(ema, tal_ema, check_names=False) + expected = tal.EMA(self.close, 10) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(ema, tal_ema, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {ema.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_fwma(self): - fwma = self.overlap.fwma(self.close) - self.assertIsInstance(fwma, Series) - self.assertEqual(fwma.name, 'FWMA_10') + result = self.overlap.fwma(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'FWMA_10') def test_hl2(self): - hl2 = self.overlap.hl2(self.high, self.low) - self.assertIsInstance(hl2, Series) - self.assertEqual(hl2.name, 'HL2') + result = self.overlap.hl2(self.high, self.low) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'HL2') def test_hlc3(self): - hlc3 = self.overlap.hlc3(self.high, self.low, self.close) - self.assertIsInstance(hlc3, Series) - self.assertEqual(hlc3.name, 'HLC3') + result = self.overlap.hlc3(self.high, self.low, self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'HLC3') try: - tal_typicalprice = tal.TYPPRICE(self.high, self.low, self.close) - pdt.assert_series_equal(hlc3, tal_typicalprice, check_names=False) + expected = tal.TYPPRICE(self.high, self.low, self.close) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(hlc3, tal_typicalprice, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {hlc3.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_hma(self): - hma = self.overlap.hma(self.close) - self.assertIsInstance(hma, Series) - self.assertEqual(hma.name, 'HMA_10') + result = self.overlap.hma(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'HMA_10') def test_ichimoku(self): ichimoku, span = self.overlap.ichimoku(self.high, self.low, self.close) @@ -107,138 +104,131 @@ class TestOverlap(TestCase): self.assertEqual(span.name, 'ICHISPAN_9_26') def test_midpoint(self): - midpoint = self.overlap.midpoint(self.close) - self.assertIsInstance(midpoint, Series) - self.assertEqual(midpoint.name, 'MIDPOINT_2') + result = self.overlap.midpoint(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'MIDPOINT_2') try: - tal_midpoint = tal.MIDPOINT(self.close, 2) - pdt.assert_series_equal(midpoint, tal_midpoint, check_names=False) + expected = tal.MIDPOINT(self.close, 2) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(midpoint, tal_midpoint, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {midpoint.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_midprice(self): - midprice = self.overlap.midprice(self.high, self.low) - self.assertIsInstance(midprice, Series) - self.assertEqual(midprice.name, 'MIDPRICE_2') + result = self.overlap.midprice(self.high, self.low) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'MIDPRICE_2') try: - tal_midprice = tal.MIDPRICE(self.high, self.low, 2) - pdt.assert_series_equal(midprice, tal_midprice, check_names=False) + expected = tal.MIDPRICE(self.high, self.low, 2) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(midprice, tal_midprice, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {midprice.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_ohlc4(self): - ohlc4 = self.overlap.ohlc4(self.open, self.high, self.low, self.close) - self.assertIsInstance(ohlc4, Series) - self.assertEqual(ohlc4.name, 'OHLC4') + result = self.overlap.ohlc4(self.open, self.high, self.low, self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'OHLC4') def test_pwma(self): - pwma = self.overlap.pwma(self.close) - self.assertIsInstance(pwma, Series) - self.assertEqual(pwma.name, 'PWMA_10') + result = self.overlap.pwma(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'PWMA_10') def test_rma(self): - rma = self.overlap.rma(self.close) - self.assertIsInstance(rma, Series) - self.assertEqual(rma.name, 'RMA_10') + result = self.overlap.rma(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'RMA_10') def test_sma(self): - sma = self.overlap.sma(self.close) - self.assertIsInstance(sma, Series) - self.assertEqual(sma.name, 'SMA_10') + result = self.overlap.sma(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'SMA_10') try: - tal_sma = tal.SMA(self.close, 10) - pdt.assert_series_equal(sma, tal_sma, check_names=False) + expected = tal.SMA(self.close, 10) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(sma, tal_sma, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {sma.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_t3(self): - t3 = self.overlap.t3(self.close) - self.assertIsInstance(t3, Series) - self.assertEqual(t3.name, 'T3_10_0.7') + result = self.overlap.t3(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'T3_10_0.7') try: - tal_t3 = tal.T3(self.close, 10) - pdt.assert_series_equal(t3, tal_t3, check_names=False) + expected = tal.T3(self.close, 10) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(t3, tal_t3, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {t3.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_tema(self): - tema = self.overlap.tema(self.close) - self.assertIsInstance(tema, Series) - self.assertEqual(tema.name, 'TEMA_10') + result = self.overlap.tema(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'TEMA_10') try: - tal_tema = tal.TEMA(self.close, 10) - pdt.assert_series_equal(tema, tal_tema, check_names=False) + expected = tal.TEMA(self.close, 10) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(tema, tal_tema, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {tema.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_trima(self): - trima = self.overlap.trima(self.close) - self.assertIsInstance(trima, Series) - self.assertEqual(trima.name, 'TRIMA_10') + result = self.overlap.trima(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'TRIMA_10') try: - tal_trima = tal.TRIMA(self.close, 10) - pdt.assert_series_equal(trima, tal_trima, check_names=False) + expected = tal.TRIMA(self.close, 10) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(trima, tal_trima, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {trima.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_vwap(self): - vwap = self.overlap.vwap(self.high, self.low, self.close, self.volume) - self.assertIsInstance(vwap, Series) - self.assertEqual(vwap.name, 'VWAP') + result = self.overlap.vwap(self.high, self.low, self.close, self.volume) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'VWAP') def test_vwma(self): - vwma = self.overlap.vwma(self.close, self.volume) - self.assertIsInstance(vwma, Series) - self.assertEqual(vwma.name, 'VWMA_10') + result = self.overlap.vwma(self.close, self.volume) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'VWMA_10') def test_wma(self): - wma = self.overlap.wma(self.close) - self.assertIsInstance(wma, Series) - self.assertEqual(wma.name, 'WMA_10') + result = self.overlap.wma(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'WMA_10') try: - tal_wma = tal.WMA(self.close, 10) - pdt.assert_series_equal(wma, tal_wma, check_names=False) + expected = tal.WMA(self.close, 10) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(wma, tal_wma, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {wma.name}['{col}']: {ex}") \ No newline at end of file + error_analysis(result, CORRELATION, ex) \ No newline at end of file diff --git a/tests/test_indicator_overlap_ext.py b/tests/test_indicator_overlap_ext.py index 54c1147..1de7ba6 100644 --- a/tests/test_indicator_overlap_ext.py +++ b/tests/test_indicator_overlap_ext.py @@ -1,5 +1,5 @@ +from .config import sample_data from .context import pandas_ta -from .data import sample_data from unittest import TestCase from pandas import DataFrame diff --git a/tests/test_indicator_performance.py b/tests/test_indicator_performance.py index c6a4281..3af1710 100644 --- a/tests/test_indicator_performance.py +++ b/tests/test_indicator_performance.py @@ -1,5 +1,5 @@ +from .config import sample_data from .context import pandas_ta -from .data import sample_data from unittest import TestCase from pandas import Series @@ -26,17 +26,19 @@ class TestPerformace(TestCase): def test_log_return(self): - log_return = self.performance.log_return(self.close) - self.assertIsInstance(log_return, Series) - self.assertEqual(log_return.name, 'LOGRET_1') + result = self.performance.log_return(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'LOGRET_1') - cumlog_return = self.performance.log_return(self.close, cumulative=True) - self.assertEqual(cumlog_return.name, 'CUMLOGRET_1') + def test_cum_log_return(self): + result = self.performance.log_return(self.close, cumulative=True) + self.assertEqual(result.name, 'CUMLOGRET_1') def test_percent_return(self): - percent_return = self.performance.percent_return(self.close) - self.assertIsInstance(percent_return, Series) - self.assertEqual(percent_return.name, 'PCTRET_1') + result = self.performance.percent_return(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'PCTRET_1') - cumpercent_return = self.performance.percent_return(self.close, cumulative=True) - self.assertEqual(cumpercent_return.name, 'CUMPCTRET_1') \ No newline at end of file + def test_cum_percent_return(self): + result = self.performance.percent_return(self.close, cumulative=True) + self.assertEqual(result.name, 'CUMPCTRET_1') \ No newline at end of file diff --git a/tests/test_indicator_performance_ext.py b/tests/test_indicator_performance_ext.py index ed5cd7e..ffda021 100644 --- a/tests/test_indicator_performance_ext.py +++ b/tests/test_indicator_performance_ext.py @@ -1,5 +1,5 @@ +from .config import sample_data from .context import pandas_ta -from .data import sample_data from unittest import TestCase # import numpy.testing as npt diff --git a/tests/test_indicator_statistics.py b/tests/test_indicator_statistics.py index 89b5a7e..2558a8b 100644 --- a/tests/test_indicator_statistics.py +++ b/tests/test_indicator_statistics.py @@ -1,5 +1,5 @@ +from .config import error_analysis, sample_data, CORRELATION, CORRELATION_THRESHOLD, VERBOSE from .context import pandas_ta -from .data import sample_data, CORRELATION_THRESHOLD, VERBOSE from unittest import TestCase, skip import pandas.util.testing as pdt @@ -37,63 +37,61 @@ class TestStatistics(TestCase): def test_kurtosis(self): - kurtosis = self.stats.kurtosis(self.close) - self.assertIsInstance(kurtosis, Series) - self.assertEqual(kurtosis.name, 'KURT_30') + result = self.stats.kurtosis(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'KURT_30') def test_mad(self): - mad = self.stats.mad(self.close) - self.assertIsInstance(mad, Series) - self.assertEqual(mad.name, 'MAD_30') + result = self.stats.mad(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'MAD_30') def test_median(self): - median = self.stats.median(self.close) - self.assertIsInstance(median, Series) - self.assertEqual(median.name, 'MEDIAN_30') + result = self.stats.median(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'MEDIAN_30') def test_quantile(self): - quantile = self.stats.quantile(self.close) - self.assertIsInstance(quantile, Series) - self.assertEqual(quantile.name, 'QTL_30_0.5') + result = self.stats.quantile(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'QTL_30_0.5') def test_skew(self): - skew = self.stats.skew(self.close) - self.assertIsInstance(skew, Series) - self.assertEqual(skew.name, 'SKEW_30') + result = self.stats.skew(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'SKEW_30') def test_stdev(self): - stdev = self.stats.stdev(self.close) - self.assertIsInstance(stdev, Series) - self.assertEqual(stdev.name, 'STDEV_30') + result = self.stats.stdev(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'STDEV_30') try: - tal_stdev = tal.STDDEV(self.close, 30) - pdt.assert_series_equal(stdev, tal_stdev, check_names=False) + expected = tal.STDDEV(self.close, 30) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(stdev, tal_stdev, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {stdev.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_variance(self): - variance = self.stats.variance(self.close) - self.assertIsInstance(variance, Series) - self.assertEqual(variance.name, 'VAR_30') + result = self.stats.variance(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'VAR_30') try: - tal_variance = tal.VAR(self.close, 30) - pdt.assert_series_equal(variance, tal_variance, check_names=False) + expected = tal.VAR(self.close, 30) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(variance, tal_variance, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {variance.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_zscore(self): - zscore = self.stats.zscore(self.close) - self.assertIsInstance(zscore, Series) - self.assertEqual(zscore.name, 'Z_30') \ No newline at end of file + result = self.stats.zscore(self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'Z_30') \ No newline at end of file diff --git a/tests/test_indicator_statistics_ext.py b/tests/test_indicator_statistics_ext.py index d7d0ab3..d359005 100644 --- a/tests/test_indicator_statistics_ext.py +++ b/tests/test_indicator_statistics_ext.py @@ -1,5 +1,5 @@ +from .config import sample_data from .context import pandas_ta -from .data import sample_data from unittest import TestCase from pandas import DataFrame diff --git a/tests/test_indicator_volatility.py b/tests/test_indicator_volatility.py index efb69a8..2064da8 100644 --- a/tests/test_indicator_volatility.py +++ b/tests/test_indicator_volatility.py @@ -1,5 +1,5 @@ +from .config import error_analysis, sample_data, CORRELATION, CORRELATION_THRESHOLD, VERBOSE from .context import pandas_ta -from .data import sample_data, CORRELATION_THRESHOLD, VERBOSE from unittest import TestCase, skip import pandas.util.testing as pdt @@ -37,98 +37,94 @@ class TestVolatility(TestCase): def test_accbands(self): - accbands = self.volatility.accbands(self.high, self.low, self.close) - self.assertIsInstance(accbands, DataFrame) - self.assertEqual(accbands.name, 'ACCBANDS_10') + result = self.volatility.accbands(self.high, self.low, self.close) + self.assertIsInstance(result, DataFrame) + self.assertEqual(result.name, 'ACCBANDS_10') def test_atr(self): - atr = self.volatility.atr(self.high, self.low, self.close) - self.assertIsInstance(atr, Series) - self.assertEqual(atr.name, 'ATR_14') + result = self.volatility.atr(self.high, self.low, self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'ATR_14') try: - tal_atr = tal.ATR(self.high, self.low, self.close) - pdt.assert_series_equal(atr, tal_atr, check_names=False) + expected = tal.ATR(self.high, self.low, self.close) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(atr, tal_atr, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {atr.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_bbands(self): - bbands = self.volatility.bbands(self.close) - self.assertIsInstance(bbands, DataFrame) - self.assertEqual(bbands.name, 'BBANDS_20') + result = self.volatility.bbands(self.close) + self.assertIsInstance(result, DataFrame) + self.assertEqual(result.name, 'BBANDS_20') try: - tal_bbands = tal.BBANDS(self.close) - tal_bbandsdf = DataFrame({'BBL_20': tal_bbands[0], 'BBM_20': tal_bbands[1], 'BBU_20': tal_bbands[2]}) - pdt.assert_frame_equal(bbands, tal_bbandsdf) + expected = tal.BBANDS(self.close) + expecteddf = DataFrame({'BBL_20': expected[0], 'BBM_20': expected[1], 'BBU_20': expected[2]}) + pdt.assert_frame_equal(result, expecteddf) except AssertionError as ae: - col = 'corr' try: - bbl_corr = pandas_ta.utils.df_error_analysis(bbands.iloc[:,0], tal_bbandsdf.iloc[:,0], col=col) + bbl_corr = pandas_ta.utils.df_error_analysis(result.iloc[:,0], expecteddf.iloc[:,0], col=CORRELATION) self.assertGreater(bbl_corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {bbands.iloc[:,0].name}['{col}']: {ex}") + error_analysis(result.iloc[:,0], CORRELATION, ex) try: - bbm_corr = pandas_ta.utils.df_error_analysis(bbands.iloc[:,1], tal_bbandsdf.iloc[:,1], col=col) + bbm_corr = pandas_ta.utils.df_error_analysis(result.iloc[:,1], expecteddf.iloc[:,1], col=CORRELATION) self.assertGreater(bbm_corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f" [!] {bbands.iloc[:,1].name}['{col}']: {ex}") + error_analysis(result.iloc[:,1], CORRELATION, ex, newline=False) try: - bbu_corr = pandas_ta.utils.df_error_analysis(bbands.iloc[:,2], tal_bbandsdf.iloc[:,2], col=col) + bbu_corr = pandas_ta.utils.df_error_analysis(result.iloc[:,2], expecteddf.iloc[:,2], col=CORRELATION) self.assertGreater(bbu_corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f" [!] {bbands.iloc[:,2].name}['{col}']: {ex}") + error_analysis(result.iloc[:,2], CORRELATION, ex, newline=False) def test_donchian(self): - donchian = self.volatility.donchian(self.close) - self.assertIsInstance(donchian, DataFrame) - self.assertEqual(donchian.name, 'DC_20') + result = self.volatility.donchian(self.close) + self.assertIsInstance(result, DataFrame) + self.assertEqual(result.name, 'DC_20') def test_kc(self): - kc = self.volatility.kc(self.high, self.low, self.close) - self.assertIsInstance(kc, DataFrame) - self.assertEqual(kc.name, 'KC_20') + result = self.volatility.kc(self.high, self.low, self.close) + self.assertIsInstance(result, DataFrame) + self.assertEqual(result.name, 'KC_20') def test_massi(self): - massi = self.volatility.massi(self.high, self.low) - self.assertIsInstance(massi, Series) - self.assertEqual(massi.name, 'MASSI_9_25') + result = self.volatility.massi(self.high, self.low) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'MASSI_9_25') def test_natr(self): - natr = self.volatility.natr(self.high, self.low, self.close) - self.assertIsInstance(natr, Series) - self.assertEqual(natr.name, 'NATR_14') + result = self.volatility.natr(self.high, self.low, self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'NATR_14') try: - tal_natr = tal.NATR(self.high, self.low, self.close) - pdt.assert_series_equal(natr, tal_natr, check_names=False) + expected = tal.NATR(self.high, self.low, self.close) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(natr, tal_natr, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {natr.name}['{col}']: {ex}") + error_analysis(result, CORRELATION, ex) def test_true_range(self): - true_range = self.volatility.true_range(self.high, self.low, self.close) - self.assertIsInstance(true_range, Series) - self.assertEqual(true_range.name, 'TRUERANGE_1') + result = self.volatility.true_range(self.high, self.low, self.close) + self.assertIsInstance(result, Series) + self.assertEqual(result.name, 'TRUERANGE_1') try: - tal_true_range = tal.TRANGE(self.high, self.low, self.close) - pdt.assert_series_equal(true_range, tal_true_range, check_names=False) + expected = tal.TRANGE(self.high, self.low, self.close) + pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col = 'corr' - corr = pandas_ta.utils.df_error_analysis(true_range, tal_true_range, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - print(f"\n [!] {true_range.name}['{col}']: {ex}") \ No newline at end of file + error_analysis(result, CORRELATION, ex) \ No newline at end of file diff --git a/tests/test_indicator_volatility_ext.py b/tests/test_indicator_volatility_ext.py index ae70ef6..1c6bcd4 100644 --- a/tests/test_indicator_volatility_ext.py +++ b/tests/test_indicator_volatility_ext.py @@ -1,5 +1,5 @@ +from .config import sample_data from .context import pandas_ta -from .data import sample_data from unittest import TestCase from pandas import DataFrame diff --git a/tests/test_indicator_volume.py b/tests/test_indicator_volume.py index a359527..6cc16b6 100644 --- a/tests/test_indicator_volume.py +++ b/tests/test_indicator_volume.py @@ -1,5 +1,5 @@ +from .config import error_analysis, sample_data, CORRELATION, CORRELATION_THRESHOLD, VERBOSE from .context import pandas_ta -from .data import error_analysis, sample_data, CORRELATION_THRESHOLD, VERBOSE from unittest import TestCase, skip import pandas.util.testing as pdt @@ -46,11 +46,10 @@ class TestVolume(TestCase): pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col='corr' - corr = pandas_ta.utils.df_error_analysis(result, expected, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - error_analysis(result, col, ex) + error_analysis(result, CORRELATION, ex) def test_adosc(self): result = self.volume.adosc(self.high, self.low, self.close, self.volume_) @@ -62,11 +61,10 @@ class TestVolume(TestCase): pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col='corr' - corr = pandas_ta.utils.df_error_analysis(result, expected, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - error_analysis(result, col, ex) + error_analysis(result, CORRELATION, ex) def test_cmf(self): result = self.volume.cmf(self.high, self.low, self.close, self.volume_) @@ -93,11 +91,10 @@ class TestVolume(TestCase): pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col='corr' - corr = pandas_ta.utils.df_error_analysis(result, expected, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - error_analysis(result, col, ex) + error_analysis(result, CORRELATION, ex) def test_nvi(self): result = self.volume.nvi(self.close, self.volume_) @@ -114,11 +111,10 @@ class TestVolume(TestCase): pdt.assert_series_equal(result, expected, check_names=False) except AssertionError as ae: try: - col='corr' - corr = pandas_ta.utils.df_error_analysis(result, expected, col=col) + corr = pandas_ta.utils.df_error_analysis(result, expected, col=CORRELATION) self.assertGreater(corr, CORRELATION_THRESHOLD) except Exception as ex: - error_analysis(result, col, ex) + error_analysis(result, CORRELATION, ex) def test_pvol(self): result = self.volume.pvol(self.close, self.volume_) diff --git a/tests/test_indicator_volume_ext.py b/tests/test_indicator_volume_ext.py index 2a7873c..571de65 100644 --- a/tests/test_indicator_volume_ext.py +++ b/tests/test_indicator_volume_ext.py @@ -1,5 +1,5 @@ +from .config import sample_data from .context import pandas_ta -from .data import sample_data from unittest import skip, TestCase from pandas import DataFrame