Skip to content

Commit c6b0574

Browse files
authored
Merge pull request #473 from bashtage/cov-corner
TST: Add coverage for additional corner cases
2 parents 53696ad + 01bb4b1 commit c6b0574

File tree

7 files changed

+307
-246
lines changed

7 files changed

+307
-246
lines changed

arch/tests/test_examples.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
pytestmark = pytest.mark.skip(reason="Required packages not available")
2121

2222
SLOW_NOTEBOOKS = ["multiple-comparison_examples.ipynb"]
23-
if bool(os.environ.get("ARCH_TEST_SLOW_NOTEBOOKS", False)):
23+
if bool(os.environ.get("ARCH_TEST_SLOW_NOTEBOOKS", False)): # pragma: no cover
2424
SLOW_NOTEBOOKS = []
2525
kernel_name = "python%s" % sys.version_info.major
2626

arch/tests/unitroot/test_phillips_ouliaris.py

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def test_pval_exceptions():
150150

151151
def test_pval_extremes():
152152
assert phillips_ouliaris_pval(3.0, "Zt", "n", 2) == 1.0
153+
np.testing.assert_allclose(phillips_ouliaris_pval(2.1, "Zt", "n", 2), 0.996850543)
153154
assert phillips_ouliaris_pval(-3000.0, "Zt", "n", 2) == 0.0
154155
# Above and below tau-star
155156
above = phillips_ouliaris_pval(1.0, "Zt", "n", 2)

arch/tests/unitroot/test_unitroot.py

+18
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from arch.unitroot.critical_values.dickey_fuller import tau_2010
2222
from arch.unitroot.unitroot import (
2323
_autolag_ols,
24+
_autolag_ols_low_memory,
2425
_is_reduced_rank,
2526
auto_bandwidth,
2627
mackinnoncrit,
@@ -746,3 +747,20 @@ def test_wrong_exceptions_variance_ratio(nobs, trend, overlap, debiased):
746747
assert np.isfinite(vr.stat)
747748
except InfeasibleTestException:
748749
pass
750+
751+
752+
def test_low_memory_singular():
753+
x = np.zeros(1000)
754+
x[:3] = np.random.standard_normal()
755+
x[-3:] = np.random.standard_normal()
756+
match = "The maximum lag you are"
757+
with pytest.raises(InfeasibleTestException, match=match):
758+
ADF(x, max_lags=10, low_memory=True).stat
759+
760+
761+
@pytest.mark.parametrize("method", ["aic", "bic", "t-stat"])
762+
@pytest.mark.parametrize("trend", ["c", "t", "ct", "ctt"])
763+
def test_autolag_ols_low_memory_smoke(trend, method):
764+
data = dataset_loader(macrodata)
765+
realgdp = np.log(data["realgdp"])
766+
_autolag_ols_low_memory(realgdp, maxlag=4, trend=trend, method=method)

0 commit comments

Comments
 (0)