From 717df493be3401b1f3cdf0037e09208fc269b03d Mon Sep 17 00:00:00 2001 From: Tom Gustafsson Date: Wed, 31 Jul 2024 12:17:55 +0300 Subject: [PATCH] fix flake8 and remove try from autodiff test --- skfem/io/meshio.py | 3 ++- tests/test_autodiff.py | 18 ++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/skfem/io/meshio.py b/skfem/io/meshio.py index 938443b3..d16d1b53 100644 --- a/skfem/io/meshio.py +++ b/skfem/io/meshio.py @@ -136,7 +136,8 @@ def from_meshio(m, ind = p2f[:, sorted_facets[0]] for itr in range(sorted_facets.shape[0] - 1): ind = ind.multiply(p2f[:, sorted_facets[itr + 1]]) - # does not preserve order: boundaries[k] = np.nonzero(ind)[0].astype(np.int32) + # does not preserve order: + # boundaries[k] = np.nonzero(ind)[0].astype(np.int32) ii, jj = ind.nonzero() boundaries[k] = ii[np.argsort(jj)] diff --git a/tests/test_autodiff.py b/tests/test_autodiff.py index f39af4b5..1c8e98f3 100644 --- a/tests/test_autodiff.py +++ b/tests/test_autodiff.py @@ -2,16 +2,14 @@ import numpy as np from numpy.testing import (assert_array_almost_equal, assert_almost_equal) -try: - import jax.numpy as jnp - from skfem.experimental.autodiff import NonlinearForm - from skfem.experimental.autodiff.helpers import (grad, dot, - ddot, mul, - div, sym_grad, - transpose, - eye, trace) -except: - pass + +import jax.numpy as jnp +from skfem.experimental.autodiff import NonlinearForm +from skfem.experimental.autodiff.helpers import (grad, dot, + ddot, mul, + div, sym_grad, + transpose, + eye, trace) from skfem.assembly import Basis from skfem.mesh import MeshTri, MeshQuad from skfem.element import (ElementTriP1, ElementTriP2,