Skip to content

Commit 032c791

Browse files
committed
use doctest ignore import errors
1 parent ccef644 commit 032c791

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

imblearn/keras/_generator.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Implement generators for ``keras`` which will balance the data."""
22
from __future__ import division
33

4-
import pytest
4+
import keras
55

66
from scipy.sparse import issparse
77

@@ -10,8 +10,6 @@
1010
from sklearn.utils import check_random_state
1111
from sklearn.utils.testing import set_random_state
1212

13-
keras = pytest.importorskip("keras")
14-
1513
from ..under_sampling import RandomUnderSampler
1614
from ..utils import Substitution
1715
from ..utils._docstring import _random_state_docstring
@@ -141,7 +139,7 @@ def __getitem__(self, index):
141139
self.indices_[index * self.batch_size:
142140
(index + 1) * self.batch_size])
143141
if issparse(sample_weight_resampled) and not self.sparse:
144-
sample_weight = sample_weight.toarray()
142+
sample_weight_resampled = sample_weight_resampled.toarray()
145143

146144
if self.sample_weight is None:
147145
return X_resampled, y_resampled

imblearn/tensorflow/_generator.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22

33
from __future__ import division
44

5-
import pytest
6-
75
from scipy.sparse import issparse
86

97
from sklearn.base import clone
108
from sklearn.utils import safe_indexing
119
from sklearn.utils import check_random_state
1210
from sklearn.utils.testing import set_random_state
1311

14-
tf = pytest.importorskip("tensorflow")
15-
1612
from ..under_sampling import RandomUnderSampler
1713
from ..utils import Substitution
1814
from ..utils._docstring import _random_state_docstring

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ doctest-fixtures = _fixture
3535
[tool:pytest]
3636
addopts =
3737
--doctest-modules
38-
38+
--doctest-ignore-import-errors

0 commit comments

Comments
 (0)