pyGAM icon indicating copy to clipboard operation
pyGAM copied to clipboard

Improve test coverage for utils.py (87% → >95%)

Open Karman580 opened this issue 8 months ago • 0 comments

This PR improves test coverage for pygam/utils.py by adding comprehensive unit tests that cover edge cases, invalid inputs, dimensional inconsistencies, and boundary conditions.

Coverage increased from approximately 87% to above 95%

All changes are isolated to pygam/tests/test_utils.py. No modifications were made to production code.

New tests cover:

  • parameter validation and constraint checking in check_param
  • shape mismatch detection in check_array and check_lengths
  • tensor dimension validations in tensor_product
  • invalid spline configurations in b_spline_basis
  • sparse/dense fallback behavior in cholesky
  • recursive parameter expansion in combine
  • rounding edge cases for scientific notation inputs
  • unsupported dtype handling and warnings in gen_edge_knots

These tests improve coverage of previously untested validation paths and exception handling in the utility layer.

All tests pass locally with:

pytest --cov=pygam

Karman580 avatar Mar 11 '26 16:03 Karman580