The accessor returned (result, span) tuple — sole exception among all indicators. Strategy loops expecting Series | DataFrame broke with AttributeError. Removed _mp_worker ichimoku special-case. Updated class docstring and indicators reference page to clarify function returns two DataFrames while accessor returns one. Added accessor return-type conformance test validating all 232 indicators return Series | DataFrame. BREAKING CHANGE: df.ta.ichimoku() no longer returns (DataFrame, DataFrame). Access callers needing forward Span must use pandas_ta.ichimoku() directly.
36 lines
906 B
Python
36 lines
906 B
Python
from tests.config import get_sample_data
|
|
|
|
from unittest import TestCase
|
|
from pandas import DataFrame, Series
|
|
|
|
|
|
class TestAccessorConformance(TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.data = get_sample_data()
|
|
|
|
@classmethod
|
|
def tearDownClass(cls):
|
|
del cls.data
|
|
|
|
def setUp(self):
|
|
pass
|
|
|
|
def tearDown(self):
|
|
pass
|
|
|
|
def test_all_indicators_return_series_or_dataframe(self):
|
|
indicator_names = self.data.ta.indicators(as_list=True)
|
|
failures = []
|
|
|
|
for name in indicator_names:
|
|
try:
|
|
result = getattr(self.data.ta, name)()
|
|
except Exception:
|
|
continue
|
|
|
|
if not isinstance(result, (Series, DataFrame)):
|
|
failures.append(f"{name}: got {type(result).__name__}")
|
|
|
|
self.assertEqual(failures, [], f"Indicators returning wrong type: {failures}")
|