Skip to content

Commit

Permalink
Add test that extra_sympy_mappings undefined raises error
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Aug 14, 2022
1 parent 8ce725f commit bfc129c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,14 @@ def test_deterministic_errors(self):
with self.assertRaises(ValueError):
model.fit(X, y)

def test_extra_sympy_mappings_undefined(self):
"""extra_sympy_mappings=None errors for custom operators"""
model = PySRRegressor(unary_operators=["square2(x) = x^2"])
X = np.random.randn(100, 2)
y = np.random.randn(100)
with self.assertRaises(ValueError):
model.fit(X, y)

def test_pickle_with_temp_equation_file(self):
"""If we have a temporary equation file, unpickle the estimator."""
model = PySRRegressor(
Expand Down

0 comments on commit bfc129c

Please sign in to comment.