Skip to content

Commit 96b70cc

Browse files
committed
Improve naming and asserts of autoscale test
1 parent 9b4ae81 commit 96b70cc

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

tests/ert/unit_tests/analysis/test_misfit_preprocessor.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,18 +142,29 @@ def test_that_correlated_and_independent_observations_are_grouped_separately(
142142

143143

144144
@pytest.mark.parametrize("nr_observations", [0, 1, 2])
145-
def test_misfit_preprocessor_single(nr_observations):
146-
"""We create nr_observations responses using the linear function y = ax.
147-
We don`t have enough information to cluster properly, so we don`t try
148-
to scale"""
149-
rng = np.random.default_rng(1234)
145+
def test_that_perfectly_correlated_responses_are_not_scaled(nr_observations):
150146
nr_realizations = 1000
151147
Y = np.ones((nr_observations, nr_realizations))
148+
149+
rng = np.random.default_rng(1234)
152150
parameters_a = rng.normal(10, 1, nr_realizations)
151+
153152
for i in range(nr_observations):
154153
Y[i] = (i + 1) * parameters_a
155-
result, *_ = main(Y, Y.mean(axis=1))
154+
155+
scale_factors, clusters, nr_components = main(Y, Y.mean(axis=1))
156+
157+
np.testing.assert_equal(
158+
scale_factors,
159+
np.array(nr_observations * [1.0]),
160+
)
161+
162+
np.testing.assert_equal(
163+
clusters,
164+
np.array(nr_observations * [1.0]),
165+
)
166+
156167
np.testing.assert_equal(
157-
result,
168+
nr_components,
158169
np.array(nr_observations * [1.0]),
159170
)

0 commit comments

Comments
 (0)