Skip to content

Commit 732fc15

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 3aee573 commit 732fc15

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

python/src/moocore/_moocore.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,9 +1464,9 @@ def eafdiff(
14641464
"""
14651465
x = np.asarray(x, dtype=float)
14661466
y = np.asarray(y, dtype=float)
1467-
assert (
1468-
x.shape[1] == y.shape[1]
1469-
), "'x' and 'y' must have the same number of columns"
1467+
assert x.shape[1] == y.shape[1], (
1468+
"'x' and 'y' must have the same number of columns"
1469+
)
14701470
nobj = x.shape[1] - 1
14711471
assert nobj == 2
14721472
maximise = _parse_maximise(maximise, nobj=nobj)

python/tests/test_moocore.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ def test_read_datasets_data(test_datapath):
2121

2222
def check_testdata(testpath, expected_name, expected_shape):
2323
testdata = moocore.read_datasets(testpath)
24-
assert (
25-
testdata.shape == expected_shape
26-
), f"Read data array has incorrect shape, should be {expected_shape} but is {testdata.shape}"
24+
assert testdata.shape == expected_shape, (
25+
f"Read data array has incorrect shape, should be {expected_shape} but is {testdata.shape}"
26+
)
2727
if expected_name != "":
2828
check_data = np.loadtxt(
2929
test_datapath(f"expected_output/read_datasets/{expected_name}")
@@ -98,26 +98,26 @@ def test_hv_output(self, test_datapath):
9898
X = self.input1
9999
dat = X[X[:, 2] == 1, :2]
100100
hv = moocore.hypervolume(dat, ref=np.array([10, 10]))
101-
assert math.isclose(
102-
hv, 90.46272765
103-
), "input1.dat hypervolume produces wrong output"
101+
assert math.isclose(hv, 90.46272765), (
102+
"input1.dat hypervolume produces wrong output"
103+
)
104104

105105
hv_ind = moocore.Hypervolume(ref=[10, 10])
106106
hv = hv_ind(dat)
107-
assert math.isclose(
108-
hv, 90.46272765
109-
), "input1.dat Hypervolume(ref = [10,10]) produces wrong output"
107+
assert math.isclose(hv, 90.46272765), (
108+
"input1.dat Hypervolume(ref = [10,10]) produces wrong output"
109+
)
110110

111111
dat = X[X[:, 2] == 2, :2]
112112
hv = moocore.hypervolume(dat, ref=[10, 10])
113-
assert math.isclose(
114-
hv, 53.969708954
115-
), "input1.dat hypervolume produces wrong output"
113+
assert math.isclose(hv, 53.969708954), (
114+
"input1.dat hypervolume produces wrong output"
115+
)
116116

117117
hv = hv_ind(dat)
118-
assert math.isclose(
119-
hv, 53.969708954
120-
), "input1.dat Hypervolume(ref = [10,10]) produces wrong output"
118+
assert math.isclose(hv, 53.969708954), (
119+
"input1.dat Hypervolume(ref = [10,10]) produces wrong output"
120+
)
121121

122122
X = moocore.read_datasets(test_datapath("duplicated3.inp"))[:, :-1]
123123
hv = moocore.hypervolume(
@@ -282,9 +282,9 @@ def test_eaf(test_datapath):
282282
expected_eaf_pct_result = np.loadtxt(
283283
test_datapath(f"expected_output/eaf/pct_{expected_eaf_name}")
284284
)
285-
assert (
286-
eaf_test.shape == expected_eaf_result.shape
287-
), f"Shapes of {test_name} and {expected_eaf_name} do not match"
285+
assert eaf_test.shape == expected_eaf_result.shape, (
286+
f"Shapes of {test_name} and {expected_eaf_name} do not match"
287+
)
288288
assert_allclose(
289289
eaf_test,
290290
expected_eaf_result,

0 commit comments

Comments
 (0)