Spaces:
Running
Running
Commit
·
179fef6
1
Parent(s):
e5b4869
Correctly set path names
Browse files- test/test.py +6 -3
test/test.py
CHANGED
|
@@ -12,6 +12,7 @@ import pandas as pd
|
|
| 12 |
import warnings
|
| 13 |
import pickle as pkl
|
| 14 |
import tempfile
|
|
|
|
| 15 |
|
| 16 |
DEFAULT_PARAMS = inspect.signature(PySRRegressor.__init__).parameters
|
| 17 |
DEFAULT_NITERATIONS = DEFAULT_PARAMS["niterations"].default
|
|
@@ -289,12 +290,14 @@ class TestPipeline(unittest.TestCase):
|
|
| 289 |
4|0.104823045|pow_abs(2.2683423, cos(f3))"""
|
| 290 |
# Strip the indents:
|
| 291 |
csv_file_data = "\n".join([l.strip() for l in csv_file_data.split("\n")])
|
| 292 |
-
|
|
|
|
|
|
|
| 293 |
f.write(csv_file_data)
|
| 294 |
-
with open("
|
| 295 |
f.write(csv_file_data)
|
| 296 |
model = load(
|
| 297 |
-
|
| 298 |
n_features_in=5,
|
| 299 |
feature_names_in=["f0", "f1", "f2", "f3", "f4"],
|
| 300 |
binary_operators=["+", "*", "/", "-", "^"],
|
|
|
|
| 12 |
import warnings
|
| 13 |
import pickle as pkl
|
| 14 |
import tempfile
|
| 15 |
+
from pathlib import Path
|
| 16 |
|
| 17 |
DEFAULT_PARAMS = inspect.signature(PySRRegressor.__init__).parameters
|
| 18 |
DEFAULT_NITERATIONS = DEFAULT_PARAMS["niterations"].default
|
|
|
|
| 290 |
4|0.104823045|pow_abs(2.2683423, cos(f3))"""
|
| 291 |
# Strip the indents:
|
| 292 |
csv_file_data = "\n".join([l.strip() for l in csv_file_data.split("\n")])
|
| 293 |
+
rand_dir = Path(tempfile.mkdtemp())
|
| 294 |
+
equation_filename = rand_dir / "equation.csv"
|
| 295 |
+
with open(equation_filename, "w") as f:
|
| 296 |
f.write(csv_file_data)
|
| 297 |
+
with open(equation_filename + ".bkup", "w") as f:
|
| 298 |
f.write(csv_file_data)
|
| 299 |
model = load(
|
| 300 |
+
equation_filename,
|
| 301 |
n_features_in=5,
|
| 302 |
feature_names_in=["f0", "f1", "f2", "f3", "f4"],
|
| 303 |
binary_operators=["+", "*", "/", "-", "^"],
|