Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
912de01
1
Parent(s):
90994b0
Add test for deprecations
Browse files- test/test.py +13 -0
test/test.py
CHANGED
@@ -264,3 +264,16 @@ class TestFeatureSelection(unittest.TestCase):
|
|
264 |
np.testing.assert_array_equal(
|
265 |
np.sort(selected_X, axis=1), np.sort(X[:, [2, 3]], axis=1)
|
266 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
np.testing.assert_array_equal(
|
265 |
np.sort(selected_X, axis=1), np.sort(X[:, [2, 3]], axis=1)
|
266 |
)
|
267 |
+
|
268 |
+
|
269 |
+
class TestMiscellaneous(unittest.TestCase):
|
270 |
+
"""Test miscellaneous functions."""
|
271 |
+
def test_deprecation(self):
|
272 |
+
# Ensure that deprecation works as expected, with a warning,
|
273 |
+
# and sets the correct value.
|
274 |
+
with self.assertWarns(DeprecationWarning):
|
275 |
+
model = PySRRegressor(fractionReplaced=0.2)
|
276 |
+
# This is a deprecated parameter, so we should get a warning.
|
277 |
+
|
278 |
+
# The correct value should be set:
|
279 |
+
self.assertEqual(model.params["fraction_replaced"], 0.2)
|