Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ repos:
additional_dependencies: ["tox>=4.12.1"]
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.4
rev: v0.9.1
hooks:
# Run the formatter.
- id: ruff-format
Expand Down
6 changes: 3 additions & 3 deletions python/src/moocore/_moocore.py
Original file line number Diff line number Diff line change
Expand Up @@ -1464,9 +1464,9 @@ def eafdiff(
"""
x = np.asarray(x, dtype=float)
y = np.asarray(y, dtype=float)
assert (
x.shape[1] == y.shape[1]
), "'x' and 'y' must have the same number of columns"
assert x.shape[1] == y.shape[1], (
"'x' and 'y' must have the same number of columns"
)
nobj = x.shape[1] - 1
assert nobj == 2
maximise = _parse_maximise(maximise, nobj=nobj)
Expand Down
36 changes: 18 additions & 18 deletions python/tests/test_moocore.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def test_read_datasets_data(test_datapath):

def check_testdata(testpath, expected_name, expected_shape):
testdata = moocore.read_datasets(testpath)
assert (
testdata.shape == expected_shape
), f"Read data array has incorrect shape, should be {expected_shape} but is {testdata.shape}"
assert testdata.shape == expected_shape, (
f"Read data array has incorrect shape, should be {expected_shape} but is {testdata.shape}"
)
if expected_name != "":
check_data = np.loadtxt(
test_datapath(f"expected_output/read_datasets/{expected_name}")
Expand Down Expand Up @@ -98,26 +98,26 @@ def test_hv_output(self, test_datapath):
X = self.input1
dat = X[X[:, 2] == 1, :2]
hv = moocore.hypervolume(dat, ref=np.array([10, 10]))
assert math.isclose(
hv, 90.46272765
), "input1.dat hypervolume produces wrong output"
assert math.isclose(hv, 90.46272765), (
"input1.dat hypervolume produces wrong output"
)

hv_ind = moocore.Hypervolume(ref=[10, 10])
hv = hv_ind(dat)
assert math.isclose(
hv, 90.46272765
), "input1.dat Hypervolume(ref = [10,10]) produces wrong output"
assert math.isclose(hv, 90.46272765), (
"input1.dat Hypervolume(ref = [10,10]) produces wrong output"
)

dat = X[X[:, 2] == 2, :2]
hv = moocore.hypervolume(dat, ref=[10, 10])
assert math.isclose(
hv, 53.969708954
), "input1.dat hypervolume produces wrong output"
assert math.isclose(hv, 53.969708954), (
"input1.dat hypervolume produces wrong output"
)

hv = hv_ind(dat)
assert math.isclose(
hv, 53.969708954
), "input1.dat Hypervolume(ref = [10,10]) produces wrong output"
assert math.isclose(hv, 53.969708954), (
"input1.dat Hypervolume(ref = [10,10]) produces wrong output"
)

X = moocore.read_datasets(test_datapath("duplicated3.inp"))[:, :-1]
hv = moocore.hypervolume(
Expand Down Expand Up @@ -282,9 +282,9 @@ def test_eaf(test_datapath):
expected_eaf_pct_result = np.loadtxt(
test_datapath(f"expected_output/eaf/pct_{expected_eaf_name}")
)
assert (
eaf_test.shape == expected_eaf_result.shape
), f"Shapes of {test_name} and {expected_eaf_name} do not match"
assert eaf_test.shape == expected_eaf_result.shape, (
f"Shapes of {test_name} and {expected_eaf_name} do not match"
)
assert_allclose(
eaf_test,
expected_eaf_result,
Expand Down
Loading