MilesCranmer commited on
Commit
857a9ad
1 Parent(s): 3f3625c

Print details of scikit-learn checks and failures

Browse files
Files changed (1) hide show
  1. test/test.py +15 -2
test/test.py CHANGED
@@ -344,5 +344,18 @@ class TestMiscellaneous(unittest.TestCase):
344
 
345
  def test_scikit_learn_compatibility(self):
346
  """Test PySRRegressor compatibility with scikit-learn."""
347
- model = PySRRegressor(max_evals=10000) # Return early.
348
- check_estimator(model)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
344
 
345
  def test_scikit_learn_compatibility(self):
346
  """Test PySRRegressor compatibility with scikit-learn."""
347
+ model = PySRRegressor(
348
+ max_evals=10000, verbosity=0, progress=False
349
+ ) # Return early.
350
+ check_generator = check_estimator(model, generate_only=True)
351
+ for (_, check) in check_generator:
352
+ try:
353
+ with warnings.catch_warnings():
354
+ warnings.simplefilter("ignore")
355
+ check(model)
356
+ print("Passed", check.func.__name__)
357
+ except Exception as e:
358
+ print("Failed", check.func.__name__, "with:")
359
+ # Add a leading tab to error message, which
360
+ # might be multi-line:
361
+ print("\n".join([(" " * 4) + row for row in str(e).split("\n")]))