Skip to content

TEST: Add constraint parsing tests for quadratic_form_test#690

Open
aeshef wants to merge 3 commits intobashtage:mainfrom
aeshef:maint/hypotheses-constraint-tests
Open

TEST: Add constraint parsing tests for quadratic_form_test#690
aeshef wants to merge 3 commits intobashtage:mainfrom
aeshef:maint/hypotheses-constraint-tests

Conversation

@aeshef
Copy link
Copy Markdown

@aeshef aeshef commented Mar 24, 2026

Came across this while running tests - the formula-based restriction path had little coverage and a couple of UX issues, so here are tests plus small fixes

Test coverage for linear constraint parsing used by quadratic_form_test. Also plus some small cleanups: strip LHS in _parse_single, clearer error if formula= is passed without a Series, remove redundant assert

pytest linearmodels/tests/shared/test_hypotheses_constraints.py

- Strip LHS in _parse_single for stable dict keys
- Raise ValueError when formula= is used without a Series params
- Remove redundant assert in InvalidTestStatistic.__str__
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.54%. Comparing base (b72f5e3) to head (cefd96e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #690      +/-   ##
==========================================
+ Coverage   99.52%   99.54%   +0.02%     
==========================================
  Files         100      101       +1     
  Lines       17366    17423      +57     
  Branches     1429     1430       +1     
==========================================
+ Hits        17283    17344      +61     
+ Misses         32       29       -3     
+ Partials       51       50       -1     
Flag Coverage Δ
adder 99.52% <100.00%> (+0.02%) ⬆️
subtractor 99.52% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@bashtage
Copy link
Copy Markdown
Owner

Thanks for this.

Copy link
Copy Markdown
Owner

@bashtage bashtage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor changes, mostly to preserve asserts that have been inserted for type checking. Overall looks very good.

Copy link
Copy Markdown
Owner

@bashtage bashtage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Will merge when green and push a new release soon.

Copy link
Copy Markdown
Owner

@bashtage bashtage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small change.

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.

2 participants