Skip to content

Fix incorrect return type annotations in darts.utils.statistics - #3185

Open
AlejandroCoronadoN wants to merge 2 commits into
unit8co:masterfrom
AlejandroCoronadoN:fix-statistics-return-annotations
Open

Fix incorrect return type annotations in darts.utils.statistics#3185
AlejandroCoronadoN wants to merge 2 commits into
unit8co:masterfrom
AlejandroCoronadoN:fix-statistics-return-annotations

Conversation

@AlejandroCoronadoN

Copy link
Copy Markdown
Contributor

Three functions in darts/utils/statistics.py have return type annotations that do not match what they actually return:

  • stationarity_test_kpss is annotated -> set but returns a tuple (it wraps statsmodels.tsa.stattools.kpss).
  • stationarity_test_adf is annotated -> set but returns a tuple (it wraps adfuller).
  • granger_causality_tests is annotated -> None but returns a dict (it wraps grangercausalitytests); its own docstring already says it returns a Dict.

The docstrings and the existing tests already treat these as tuples/dict (for example stationarity_test_kpss(series)[1]), so the annotations are just wrong and mislead type checkers and IDEs. This fixes the annotations to match the real return values and adds a small regression test.

@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.98%. Comparing base (2be8e43) to head (6c1b008).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3185      +/-   ##
==========================================
- Coverage   97.04%   96.98%   -0.07%     
==========================================
  Files         165      165              
  Lines       17976    17976              
==========================================
- Hits        17445    17434      -11     
- Misses        531      542      +11     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AlejandroCoronadoN
AlejandroCoronadoN force-pushed the fix-statistics-return-annotations branch from c77c729 to 6c1b008 Compare August 21, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant