Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
bfc129c
1
Parent(s):
8ce725f
Add test that extra_sympy_mappings undefined raises error
Browse files- test/test.py +8 -0
test/test.py
CHANGED
@@ -538,6 +538,14 @@ class TestMiscellaneous(unittest.TestCase):
|
|
538 |
with self.assertRaises(ValueError):
|
539 |
model.fit(X, y)
|
540 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
541 |
def test_pickle_with_temp_equation_file(self):
|
542 |
"""If we have a temporary equation file, unpickle the estimator."""
|
543 |
model = PySRRegressor(
|
|
|
538 |
with self.assertRaises(ValueError):
|
539 |
model.fit(X, y)
|
540 |
|
541 |
+
def test_extra_sympy_mappings_undefined(self):
|
542 |
+
"""extra_sympy_mappings=None errors for custom operators"""
|
543 |
+
model = PySRRegressor(unary_operators=["square2(x) = x^2"])
|
544 |
+
X = np.random.randn(100, 2)
|
545 |
+
y = np.random.randn(100)
|
546 |
+
with self.assertRaises(ValueError):
|
547 |
+
model.fit(X, y)
|
548 |
+
|
549 |
def test_pickle_with_temp_equation_file(self):
|
550 |
"""If we have a temporary equation file, unpickle the estimator."""
|
551 |
model = PySRRegressor(
|