Skip to content

Commit

Permalink
rename test_optsto check_opts
Browse files Browse the repository at this point in the history
  • Loading branch information
apozharski committed Sep 14, 2023
1 parent acf2aea commit 05bbbb8
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions test/simple_sim_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

TOL = 1e-7


def compute_errors(results, model) -> dict:
X_sim = results["X_sim"]
err_x0 = np.abs(X_sim[0] - X0)
Expand All @@ -44,7 +43,7 @@ def compute_errors(results, model) -> dict:
}


def test_opts(opts, model):
def check_opts(opts, model):
results = solve_simplest_example(opts=opts, model=model)
errors = compute_errors(results, model)

Expand All @@ -62,7 +61,7 @@ class SimpleTests(unittest.TestCase):

def test_default(self):
model = get_simplest_model_sliding()
test_opts(get_default_options(), model)
check_opts(get_default_options(), model)

def test_switch(self):
model = get_simplest_model_switch()
Expand All @@ -80,7 +79,7 @@ def test_switch(self):
opts.cross_comp_mode = cross_comp_mode
opts.print_level = 0
try:
test_opts(opts, model=model)
check_opts(opts, model=model)
except:
raise Exception(f"test_switch failed with setting:\n {ns=} {Nfe=} {pss_mode=} {cross_comp_mode=}")
print("main_test_switch: SUCCESS")
Expand All @@ -100,7 +99,7 @@ def test_sliding(self):
opts.N_finite_elements = Nfe
opts.pss_mode = pss_mode
try:
test_opts(opts, model=model)
check_opts(opts, model=model)
except:
raise Exception(f"test_sliding failed with setting:\n {ns=} {Nfe=} {pss_mode=} {irk_scheme=}")
print("main_test_sliding: SUCCESS")
Expand All @@ -117,7 +116,7 @@ def test_discretization(self):
opts.print_level = 0
opts.irk_representation = irk_representation
try:
test_opts(opts, model=model)
check_opts(opts, model=model)
except:
raise Exception(f"Test failed with setting:\n {opts=} \n{model=}")
print("main_test_sliding: SUCCESS")
Expand Down Expand Up @@ -169,7 +168,7 @@ def test_least_squares_problem(self):
opts.gamma_h = np.inf

try:
results = test_opts(opts, model=model)
results = check_opts(opts, model=model)
print(results["t_grid"])
except:
raise Exception(f"Test failed.")
Expand All @@ -196,7 +195,7 @@ def test_least_squares_problem_opts(self):
opts.gamma_h = np.inf

try:
results = test_opts(opts, model=model)
results = check_opts(opts, model=model)
# print(results["t_grid"])
except:
# print(f"Test failed with {fix_as=}, {step_equilibration=}")
Expand All @@ -213,7 +212,7 @@ def test_initializations(self):
opts.initialization_strategy = initialization_strategy
print(f"\ntesting initialization_strategy = {initialization_strategy}")
try:
test_opts(opts, model=model)
check_opts(opts, model=model)
except:
raise Exception(f"Test failed with setting:\n {opts=}")

Expand All @@ -225,7 +224,7 @@ def test_polishing(self):
opts.do_polishing_step = True
opts.comp_tol = 1e-3
try:
test_opts(opts, model=model)
check_opts(opts, model=model)
except:
raise Exception(f"Test failed with setting:\n {opts=} \n{model=}")

Expand Down

0 comments on commit 05bbbb8

Please sign in to comment.