Skip to content

Commit 203a96c

Browse files
agramfortlarsoner
authored andcommitted
MAINT: splitting utils.py to submodules (#5862)
* moving utils.py to a folder * split into separate files as much as possible * move utils tests * cleanup * FIX: Multiple fixes * FIX: Almost there * FIX: Reorganize tests * FIX: Reorganize tests, too * FIX: Move * FIX: Older Pandas * FIX: Missing files
1 parent 62d32c2 commit 203a96c

28 files changed

+4954
-4605
lines changed

mne/tests/test_docstring_parameters.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ def test_documented():
290290
from_mod = inspect.getmodule(cf).__name__
291291
if (from_mod.startswith('mne') and
292292
not from_mod.startswith('mne.externals') and
293-
from_mod not in documented_ignored_mods and
293+
not any(from_mod.startswith(x)
294+
for x in documented_ignored_mods) and
294295
name not in documented_ignored_names):
295296
missing.append('%s (%s.%s)' % (name, from_mod, name))
296297
if len(missing) > 0:

mne/tests/test_epochs.py

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
bootstrap, equalize_epoch_counts, combine_event_ids, add_channels_epochs,
2828
EpochsArray, concatenate_epochs, BaseEpochs, average_movements)
2929
from mne.utils import (requires_pandas, run_tests_if_main,
30-
requires_version, _check_pandas_installed,
31-
catch_logging)
30+
requires_version, catch_logging, _FakeNoPandas)
3231
from mne.chpi import read_head_pos, head_pos_to_trans_rot_t
3332

3433
from mne.io import RawArray, read_raw_fif
@@ -2244,22 +2243,6 @@ def test_default_values():
22442243
assert_equal(hash(epoch_1), hash(epoch_2))
22452244

22462245

2247-
class FakeNoPandas(object): # noqa: D101
2248-
def __enter__(self): # noqa: D105
2249-
2250-
def _check(strict=True):
2251-
if strict:
2252-
raise RuntimeError('Pandas not installed')
2253-
else:
2254-
return False
2255-
mne.epochs._check_pandas_installed = _check
2256-
mne.utils._check_pandas_installed = _check
2257-
2258-
def __exit__(self, *args): # noqa: D105
2259-
mne.epochs._check_pandas_installed = _check_pandas_installed
2260-
mne.utils._check_pandas_installed = _check_pandas_installed
2261-
2262-
22632246
@requires_pandas
22642247
def test_metadata(tmpdir):
22652248
"""Test metadata support with pandas."""
@@ -2352,7 +2335,7 @@ def test_metadata(tmpdir):
23522335
epochs_one_read = read_epochs(temp_one_fname)
23532336
assert_metadata_equal(epochs_one.metadata, epochs_one_read.metadata)
23542337

2355-
with FakeNoPandas():
2338+
with _FakeNoPandas():
23562339
epochs_read = read_epochs(temp_fname)
23572340
assert isinstance(epochs_read.metadata, list)
23582341
assert isinstance(epochs_read.metadata[0], dict)

0 commit comments

Comments
 (0)