Skip to content

Commit

Permalink
add test_rejection
Browse files Browse the repository at this point in the history
wrote a test to check wheter the rejection class works as intendet
  • Loading branch information
daklauss committed Aug 6, 2024
1 parent 0e6d2f5 commit 412e2b5
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
37 changes: 37 additions & 0 deletions tests/test_rejection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import numpy as np
import pytest

from CADETPythonSimulator.rejection import (
RejectionBase, StepCutOff
)








TestCaseCutof = {
"model": StepCutOff,
"model_param": {
"cutoff_weight": 0.5
},
"weights": [0, 0.5, 1],
"expected": [0, 1, 1]
}

@pytest.mark.parametrize(
"parameters",
[
TestCaseCutof
]
)

class TestRejection():
def test_get_rejection(self, parameters):

model = parameters["model"](**parameters["model_param"])

solution = [model.get_rejection(weight) for weight in parameters["weights"]]
np.testing.assert_array_almost_equal(solution, parameters["expected"])
5 changes: 4 additions & 1 deletion tests/test_residual.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ def test_calculation_concentration_cstr(self, parameters):

param_vec_conc = parameters["values"].values()

np.testing.assert_array_almost_equal(calculate_residual_concentration_cstr(*param_vec_conc), parameters["expected"])
np.testing.assert_array_almost_equal(
calculate_residual_concentration_cstr(*param_vec_conc),
parameters["expected"]
)



Expand Down

0 comments on commit 412e2b5

Please sign in to comment.