Skip to content

Commit

Permalink
Fix test wrt platform
Browse files Browse the repository at this point in the history
  • Loading branch information
relf committed Dec 5, 2023
1 parent f11119c commit 9867c7f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion smt/applications/tests/test_ego.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ def f_obj(X):
)
x_opt, y_opt, dnk, x_data, y_data = ego.optimize(fun=f_obj)
if ds.HAS_CONFIG_SPACE: # results differs wrt config_space impl
if platform == "Linux": # results differs wrt platform
if platform.startsWith("linux"): # results differs wrt platform
self.assertAlmostEqual(np.sum(y_data), 1.0355815090110578, delta=1e-12)
self.assertAlmostEqual(np.sum(x_data), 38.23494224077761, delta=1e-12)
else:
Expand Down
11 changes: 6 additions & 5 deletions smt/tests/test_kpls_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import numpy as np
import unittest
import inspect
from sys import platform

from collections import OrderedDict

Expand Down Expand Up @@ -35,8 +36,6 @@ def setUp(self):
problems["exp"] = TensorProduct(ndim=ndim, func="exp")
problems["tanh"] = TensorProduct(ndim=ndim, func="tanh")
problems["cos"] = TensorProduct(ndim=ndim, func="cos")
sms = OrderedDict()
sms["KPLS"] = KPLS(eval_n_comp=True)

t_errors = {}
e_errors = {}
Expand All @@ -47,14 +46,16 @@ def setUp(self):
n_comp_opt["Branin"] = 2
n_comp_opt["Rosenbrock"] = 1
n_comp_opt["sphere"] = 1
n_comp_opt["exp"] = 3
if platform.startsWith("linux"): # result depends on platform
n_comp_opt["exp"] = 2
else:
n_comp_opt["exp"] = 3
n_comp_opt["tanh"] = 1
n_comp_opt["cos"] = 1

self.nt = nt
self.ne = ne
self.problems = problems
self.sms = sms
self.t_errors = t_errors
self.e_errors = e_errors
self.n_comp_opt = n_comp_opt
Expand All @@ -74,7 +75,7 @@ def run_test(self):
xe = sampling(self.ne)
ye = prob(xe)

sm0 = self.sms[sname]
sm0 = KPLS(eval_n_comp=True)

sm = sm0.__class__()
sm.options = sm0.options.clone()
Expand Down

0 comments on commit 9867c7f

Please sign in to comment.