Skip to content

Commit

Permalink
fix: F401
Browse files Browse the repository at this point in the history
  • Loading branch information
paquiteau committed Feb 16, 2024
1 parent 3577937 commit b16242c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 25 deletions.
8 changes: 2 additions & 6 deletions tests/test_algorithms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

"""UNIT TESTS FOR Algorithms.
This module contains unit tests for the modopt.opt module.
Expand All @@ -8,6 +7,7 @@
Pierre-Antoine Comby <[email protected]>
"""

from importlib.utils import find_spec
import numpy as np
import numpy.testing as npt
from modopt.opt import algorithms, cost, gradient, linear, proximity, reweight
Expand All @@ -18,11 +18,7 @@
)


SKLEARN_AVAILABLE = True
try:
import sklearn
except ImportError:
SKLEARN_AVAILABLE = False
SKLEARN_AVAILABLE = find_spec("sklearn") is not None


@fixture
Expand Down
15 changes: 3 additions & 12 deletions tests/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Pierre-Antoine Comby <[email protected]>
"""

from importlib.utils import find_spec
import pytest
from test_helpers import failparam, skipparam

Expand All @@ -16,18 +17,8 @@

from modopt.math import convolve, matrix, metrics, stats

try:
import astropy
except ImportError: # pragma: no cover
ASTROPY_AVAILABLE = False
else: # pragma: no cover
ASTROPY_AVAILABLE = True
try:
from skimage.metrics import structural_similarity as compare_ssim
except ImportError: # pragma: no cover
SKIMAGE_AVAILABLE = False
else:
SKIMAGE_AVAILABLE = True
ASTROPY_AVAILABLE = find_spec("astropy") is not None
SKIMAGE_AVAILABLE = find_spec("skimage.metrics")


class TestConvolve:
Expand Down
11 changes: 4 additions & 7 deletions tests/test_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
Pierre-Antoine Comby <[email protected]>
"""

from importlib.utils import find_spec

import numpy as np
import numpy.testing as npt
import pytest
Expand All @@ -16,16 +18,11 @@

from test_helpers import Dummy

SKLEARN_AVAILABLE = True
try:
import sklearn
except ImportError:
SKLEARN_AVAILABLE = False
SKLEARN_AVAILABLE = find_spec("sklearn") is not None

PYWT_AVAILABLE = True
PYWT_AVAILABLE = find_spec("joblib") is not None
try:
import pywt
import joblib
except ImportError:
PYWT_AVAILABLE = False

Expand Down

0 comments on commit b16242c

Please sign in to comment.