Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /freqtrade_freqtrade /tests /test_indicators.py
| import importlib | |
| import warnings | |
| import numpy as np | |
| import pandas as pd | |
| import pytest | |
| def test_crossed_numpy_types(): | |
| """ | |
| This test is only present since this method currently diverges from the qtpylib implementation. | |
| And we must ensure to not break this again once we update from the original source. | |
| """ | |
| series = pd.Series([56, 97, 19, 76, 65, 25, 87, 91, 79, 79]) | |
| expected_result = pd.Series([False, True, False, True, False, False, True, False, False, False]) | |
| # freqtrade.vendor.qtpylib is a deprecated shim around technical and emits a | |
| # FutureWarning on import - suppress it here, it's asserted below. | |
| with warnings.catch_warnings(): | |
| warnings.simplefilter("ignore", FutureWarning) | |
| import freqtrade.vendor.qtpylib.indicators as qtpylib | |
| assert qtpylib.crossed_above(series, 60).equals(expected_result) | |
| assert qtpylib.crossed_above(series, 60.0).equals(expected_result) | |
| assert qtpylib.crossed_above(series, np.int32(60)).equals(expected_result) | |
| assert qtpylib.crossed_above(series, np.int64(60)).equals(expected_result) | |
| assert qtpylib.crossed_above(series, np.float64(60.0)).equals(expected_result) | |
| def test_qtpylib_deprecation(): | |
| """freqtrade.vendor.qtpylib.indicators only re-exports technical now and is deprecated.""" | |
| with warnings.catch_warnings(): | |
| warnings.simplefilter("ignore", FutureWarning) | |
| import freqtrade.vendor.qtpylib.indicators as qtpylib | |
| with pytest.warns(FutureWarning, match="freqtrade.vendor.qtpylib.indicators' is deprecated"): | |
| importlib.reload(qtpylib) | |
Xet Storage Details
- Size:
- 1.7 kB
- Xet hash:
- f4ac6b4ea4b669e936b05891b34d7e2c0fa0a8c181961792dffe33310c318304
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.