Skip to content

Commit 1211caa

Browse files
committed
FIX: TypeError for formula= params; keep assert for type checker
1 parent 9eba892 commit 1211caa

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

linearmodels/shared/hypotheses.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ def critical_values(self) -> None:
135135
def __str__(self) -> str:
136136
msg = "Invalid test statistic\n{reason}\n{name}"
137137
name = "" if self._name is None else self._name
138+
assert name is not None
138139
return msg.format(name=name, reason=self._reason)
139140

140141

@@ -226,10 +227,11 @@ def quadratic_form_test(
226227
raise ValueError("restriction and formula cannot be used simultaneously.")
227228
if formula is not None:
228229
if not isinstance(params, Series):
229-
raise ValueError(
230+
raise TypeError(
230231
"params must be a pandas Series when using formula= to specify "
231232
"linear restrictions (indexed by parameter names)."
232233
)
234+
assert isinstance(params, Series)
233235
param_names = [str(p) for p in params.index]
234236
rewritten_constraints = _reparse_constraint_formula(formula)
235237
lc = LinearConstraints.from_spec(rewritten_constraints, param_names)

0 commit comments

Comments
 (0)