Skip to content

Commit e03c25d

Browse files
committed
python/tests/test_bugs.py (test_bug38): New test.
1 parent b35ac44 commit e03c25d

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

python/tests/test_bugs.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
def test_bug27():
1010
"""Invalid output of is_nondominated() with single-objective inputs."""
11-
x = np.asarray([[0.5], [0.6], [0.3], [0.1], [0.0], [0.9], [0.0]])
11+
x = np.array([[0.5], [0.6], [0.3], [0.1], [0.0], [0.9], [0.0]])
1212

1313
assert_array_equal(
1414
moocore.is_nondominated(x),
@@ -50,3 +50,28 @@ def test_bug29():
5050
x = [[0.2], [0.1], [0.2], [0.5], [0.3]]
5151
assert_array_equal(moocore.pareto_rank(x), [1, 0, 1, 3, 2])
5252
assert_array_equal(moocore.pareto_rank(x, maximise=True), [2, 3, 2, 0, 1])
53+
54+
55+
def test_bug38():
56+
"""Unexpected behavior of is_nondominated with 4+ objectives."""
57+
x = np.array([[0, 0, 0, 0], [1, 1, 1, 1]])
58+
assert_array_equal(
59+
moocore.is_nondominated(x, maximise=[False, True, True, True]),
60+
[True, True],
61+
)
62+
assert_array_equal(
63+
moocore.is_nondominated(x, maximise=[True, False, True, True]),
64+
[True, True],
65+
)
66+
assert_array_equal(
67+
moocore.is_nondominated(x, maximise=[True, True, False, True]),
68+
[True, True],
69+
)
70+
assert_array_equal(
71+
moocore.is_nondominated(x, maximise=[True, True, True, False]),
72+
[True, True],
73+
)
74+
assert_array_equal(
75+
moocore.is_nondominated(x, maximise=False), [True, False]
76+
)
77+
assert_array_equal(moocore.is_nondominated(x, maximise=True), [False, True])

0 commit comments

Comments
 (0)