Skip to content

Commit d1fc85f

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

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import textwrap
22
from importlib.util import find_spec
33

4-
import pytest
54
from runtime_introspect import runtime_feature_set
65

76
import gpgi
@@ -16,7 +15,8 @@ def pytest_configure(config):
1615
mpl.use("Agg")
1716
else: # pragma: no cover
1817
config.addinivalue_line(
19-
"markers", "mpl_image_compare: partial skip (missing requirement: pytest_mpl)"
18+
"markers",
19+
"mpl_image_compare: partial skip (missing requirement: pytest_mpl)",
2020
)
2121

2222

tests/test_deposit.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from contextlib import nullcontext
33
from copy import deepcopy
44
from functools import partial
5+
from importlib.util import find_spec
56
from threading import Lock
67

78
import numpy as np
@@ -11,9 +12,9 @@
1112
import gpgi
1213
from gpgi._lib import _deposit_ngp_2D
1314

14-
from importlib.util import find_spec
1515
HAVE_PYTEST_MPL = find_spec("pytest-mpl") is not None
1616

17+
1718
@pytest.fixture()
1819
def sample_2D_dataset():
1920
nparticles = 100
@@ -122,12 +123,13 @@ def fake_dep(*args, metadata=None, **kwargs):
122123
@pytest.mark.parametrize("method", ["ngp", "cic", "tsc"])
123124
@pytest.mark.mpl_image_compare
124125
def test_2D_deposit(sample_2D_dataset, method):
125-
126126
ds = sample_2D_dataset
127127
particle_density = ds.deposit("mass", method=method)
128128

129-
if not HAVE_PYTEST_MPL: return
129+
if not HAVE_PYTEST_MPL:
130+
return
130131
from matplotlib.figure import Figure
132+
131133
fig = Figure()
132134
ax = fig.add_subplot()
133135

@@ -181,7 +183,8 @@ def test_1D_deposit(method, grid_type):
181183
if method == "ngp":
182184
assert mass.sum() == ds.particles.count
183185

184-
if not HAVE_PYTEST_MPL: return
186+
if not HAVE_PYTEST_MPL:
187+
return
185188
fig = Figure()
186189
ax = fig.add_subplot()
187190
ax.set(xlabel="x", ylabel="particle mass", title=f"Deposition method '{method}'")
@@ -245,7 +248,6 @@ def test_3D_deposit(method, dtype):
245248
assert deposit_3D.shape == tuple(a - 2 for a in full_deposit_3D.shape)
246249

247250

248-
249251
@pytest.mark.mpl_image_compare
250252
def test_readme_example():
251253
nx = ny = 64
@@ -274,10 +276,10 @@ def test_readme_example():
274276

275277
particle_mass = ds.deposit("mass", method="nearest_grid_point")
276278

277-
if not HAVE_PYTEST_MPL: return
279+
if not HAVE_PYTEST_MPL:
280+
return
278281
from matplotlib.figure import Figure
279282

280-
281283
fig = Figure()
282284
ax = fig.add_subplot()
283285
ax.set(aspect=1, xlabel="x", ylabel="y")

0 commit comments

Comments
 (0)