Repository navigation
TST: Tidy the tests of the unit weights of the IV models - #865
Merged
Merged
Conversation
Follow-up to #862. The tests it added now follow the conventions of the test suite: - Floats are compared with a tolerance (rtol=1e-12) instead of rtol=0, atol=0. The estimates are equal to the last bit today, but linearmodels never compares floats exactly in its tests, since the last bits differ between platforms. - The data come from np.random.default_rng instead of RandomState. - The MissingValueWarning of a NaN weight is matched on its message. - test_weights_float32_not_upcast_by_weighting is renamed test_weights_float32_inputs. IVData stores float32 data as float64, so the name described something that does not happen. The test now also checks the dtype, so the test shows what changes if a later version keeps float32 (the rest of #607). - The tests that the weighted arrays are not copied and that the results do not change run for every IV estimator (IV2SLS, IVLIML, IVGMM, IVGMMCUE and IVJIVE), since the copies are made in their common base class. Refs #607
bashtage
marked this pull request as ready for review
November 6, 2026 14:39
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #865 +/- ##
=======================================
Coverage 99.68% 99.68%
=======================================
Files 200 200
Lines 38076 38080 +4
Branches 2442 2442
=======================================
+ Hits 37955 37959 +4
Misses 51 51
Partials 70 70
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #862. The tests it added now follow the conventions of the test
suite:
rtol=0, atol=0. The estimates are equal to the last bit today, but
linearmodels never compares floats exactly in its tests, since the last bits
differ between platforms.
test_weights_float32_inputs. IVData stores float32 data as float64, so the
name described something that does not happen. The test now also checks the
dtype, so the test shows what changes if a later version keeps float32 (the
rest of MemoryError with IV2SLS #607).
change run for every IV estimator (IV2SLS, IVLIML, IVGMM, IVGMMCUE and
IVJIVE), since the copies are made in their common base class.
Refs #607
🤖 Generated with Claude Code