From 3a06560e990d15204b06f128b700f1963fb123fe Mon Sep 17 00:00:00 2001 From: gjunjie Date: Fri, 3 Apr 2026 13:47:16 -0400 Subject: [PATCH 1/2] BUG: Use vol_model instead of vol for p type check in arch_model The p-is-int guard compared against the raw `vol` parameter (e.g. "GARCH") using lowercase strings, so it never matched and silently allowed non-int p values through. Made-with: Cursor --- arch/univariate/mean.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/univariate/mean.py b/arch/univariate/mean.py index 8748666236..a521a8ac26 100644 --- a/arch/univariate/mean.py +++ b/arch/univariate/mean.py @@ -2035,7 +2035,7 @@ def arch_model( else: # mean == "zero" am = ZeroMean(y, hold_back=hold_back, rescale=rescale) - if vol in ("arch", "garch", "figarch", "egarch", "aparch") and not isinstance( + if vol_model in ("arch", "garch", "figarch", "egarch", "aparch") and not isinstance( p, int ): raise TypeError( From a8a7fd825451e5fd7f4317aa17a148c86e075ac1 Mon Sep 17 00:00:00 2001 From: gjunjie Date: Fri, 3 Apr 2026 14:31:28 -0400 Subject: [PATCH 2/2] TST: Update test to expect TypeError instead of AssertionError Made-with: Cursor --- arch/tests/univariate/test_mean.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/tests/univariate/test_mean.py b/arch/tests/univariate/test_mean.py index 46024bcaed..862b8c1d5d 100644 --- a/arch/tests/univariate/test_mean.py +++ b/arch/tests/univariate/test_mean.py @@ -1383,7 +1383,7 @@ def test_false_reindex(): def test_invalid_arch_model(): - with pytest.raises(AssertionError): + with pytest.raises(TypeError): arch_model(SP500, p="3")