Skip to content

Commit 98d9b5f

Browse files
committed
Delete outdated tests
1 parent 94b9a51 commit 98d9b5f

3 files changed

Lines changed: 4 additions & 58 deletions

File tree

src/muse/decisions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ def retro_epsilon_constraints(
442442
def adapt_param(name, minimize, epsilon=None):
443443
"""Adjust epsilon so that current asset is always feasible."""
444444
if epsilon is None:
445-
return name, minimize
445+
return name, minimize, None
446446

447447
current = asset_objectives[name]
448448

tests/test_decisions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import numpy as np
2+
import xarray as xr
23
from numpy.random import choice, rand
34
from pytest import approx, fixture
45
from scipy.stats import rankdata
5-
from xarray import Dataset
66

77
from muse.decisions import (
88
epsilon_constraints,
@@ -15,7 +15,7 @@
1515

1616
@fixture
1717
def objectives():
18-
objectives = Dataset()
18+
objectives = xr.Dataset()
1919
objectives["replacement"] = choice(
2020
list("abcdefghijklmnopqrstuvwxyz"), 10, replace=False
2121
)
@@ -96,7 +96,7 @@ def test_lexical():
9696
c[i, j] / minc[i],
9797
)
9898

99-
objectives = Dataset(
99+
objectives = xr.Dataset(
100100
{
101101
"a": (("asset", "replacement"), a),
102102
"b": (("asset", "replacement"), b),

tests/test_utilities.py

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -148,60 +148,6 @@ def test_tupled_dimension_3d():
148148
verify_tupled_output(actual, array, axis, indices)
149149

150150

151-
def create_test_objectives(shape=(5, 10)):
152-
"""Create test objectives dataset."""
153-
objectives = xr.Dataset()
154-
for var in ["a", "b", "c"]:
155-
objectives[var] = ("asset", "replacement"), np.random.rand(*shape) * 10 - 5
156-
objectives["asset"] = np.random.choice(
157-
objectives.replacement, len(objectives.asset), replace=False
158-
)
159-
return objectives
160-
161-
162-
def create_test_binsizes():
163-
"""Create test binsizes dataset."""
164-
return xr.Dataset(
165-
{
166-
"a": np.random.rand() * 0.1,
167-
"b": -np.random.rand() * 0.1,
168-
"c": np.random.rand(),
169-
}
170-
)
171-
172-
173-
@mark.parametrize("order", [["a", "b", "c"], ["b", "c", "a"], ["c", "a", "b"]])
174-
def test_lexical_comparison(order):
175-
"""Test lexical comparison with and without binning."""
176-
from muse.utilities import lexical_comparison
177-
178-
objectives = create_test_objectives()
179-
binsizes = create_test_binsizes()
180-
181-
def create_expected(bin_last=True):
182-
expected = np.zeros(shape=objectives.a.shape, dtype=object)
183-
for i in range(expected.shape[0]):
184-
for j in range(expected.shape[1]):
185-
values = []
186-
for k in range(3):
187-
val = objectives[order[k]][i, j] / binsizes[order[k]]
188-
values.append(int(np.floor(val)) if bin_last or k < 2 else val)
189-
expected[i, j] = tuple(values)
190-
return expected
191-
192-
# Test with binning
193-
actual = lexical_comparison(objectives, binsizes[order])
194-
expected = create_expected(bin_last=True)
195-
assert actual.shape == expected.shape
196-
assert (actual.values == expected).all()
197-
198-
# Test without binning last value
199-
actual = lexical_comparison(objectives, binsizes[order], bin_last=False)
200-
expected = create_expected(bin_last=False)
201-
assert actual.shape == expected.shape
202-
assert (actual.values == expected).all()
203-
204-
205151
def test_merge_assets():
206152
"""Test merging assets with different coordinate orders."""
207153
from numpy import arange

0 commit comments

Comments
 (0)