Spaces:
Running
Running
Include test of multi-line seval
Browse files- pysr/test/test.py +13 -0
pysr/test/test.py
CHANGED
|
@@ -99,6 +99,19 @@ class TestPipeline(unittest.TestCase):
|
|
| 99 |
# Test options stored:
|
| 100 |
self.assertEqual(model.julia_options_.turbo, True)
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
def test_high_precision_search_custom_loss(self):
|
| 103 |
y = 1.23456789 * self.X[:, 0]
|
| 104 |
model = PySRRegressor(
|
|
|
|
| 99 |
# Test options stored:
|
| 100 |
self.assertEqual(model.julia_options_.turbo, True)
|
| 101 |
|
| 102 |
+
def test_multiline_seval(self):
|
| 103 |
+
if jl.seval('VERSION >= v"1.9"'):
|
| 104 |
+
# The user should be able to run multiple things in a single seval call:
|
| 105 |
+
num = jl.seval(
|
| 106 |
+
"""
|
| 107 |
+
function my_new_objective(x)
|
| 108 |
+
x^2
|
| 109 |
+
end
|
| 110 |
+
1.5
|
| 111 |
+
"""
|
| 112 |
+
)
|
| 113 |
+
self.assertEqual(num, 1.5)
|
| 114 |
+
|
| 115 |
def test_high_precision_search_custom_loss(self):
|
| 116 |
y = 1.23456789 * self.X[:, 0]
|
| 117 |
model = PySRRegressor(
|