MilesCranmer commited on
Commit
6671f5e
1 Parent(s): 19fb456

Add test for power law warning

Browse files
Files changed (1) hide show
  1. pysr/test/test.py +6 -0
pysr/test/test.py CHANGED
@@ -20,6 +20,7 @@ from ..sr import (
20
  _csv_filename_to_pkl_filename,
21
  idx_model_selection,
22
  _check_assertions,
 
23
  )
24
  from ..export_latex import to_latex
25
 
@@ -553,6 +554,11 @@ class TestMiscellaneous(unittest.TestCase):
553
  # The correct value should be set:
554
  self.assertEqual(model.fraction_replaced, 0.2)
555
 
 
 
 
 
 
556
  def test_size_warning(self):
557
  """Ensure that a warning is given for a large input size."""
558
  model = PySRRegressor()
 
20
  _csv_filename_to_pkl_filename,
21
  idx_model_selection,
22
  _check_assertions,
23
+ _process_constraints,
24
  )
25
  from ..export_latex import to_latex
26
 
 
554
  # The correct value should be set:
555
  self.assertEqual(model.fraction_replaced, 0.2)
556
 
557
+ def test_power_law_warning(self):
558
+ """Ensure that a warning is given for a power law operator."""
559
+ with self.assertWarns(UserWarning):
560
+ _process_constraints(["^"], [], {})
561
+
562
  def test_size_warning(self):
563
  """Ensure that a warning is given for a large input size."""
564
  model = PySRRegressor()