|
27 | 27 | bootstrap, equalize_epoch_counts, combine_event_ids, add_channels_epochs,
|
28 | 28 | EpochsArray, concatenate_epochs, BaseEpochs, average_movements)
|
29 | 29 | 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) |
32 | 31 | from mne.chpi import read_head_pos, head_pos_to_trans_rot_t
|
33 | 32 |
|
34 | 33 | from mne.io import RawArray, read_raw_fif
|
@@ -2244,22 +2243,6 @@ def test_default_values():
|
2244 | 2243 | assert_equal(hash(epoch_1), hash(epoch_2))
|
2245 | 2244 |
|
2246 | 2245 |
|
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 |
| - |
2263 | 2246 | @requires_pandas
|
2264 | 2247 | def test_metadata(tmpdir):
|
2265 | 2248 | """Test metadata support with pandas."""
|
@@ -2352,7 +2335,7 @@ def test_metadata(tmpdir):
|
2352 | 2335 | epochs_one_read = read_epochs(temp_one_fname)
|
2353 | 2336 | assert_metadata_equal(epochs_one.metadata, epochs_one_read.metadata)
|
2354 | 2337 |
|
2355 |
| - with FakeNoPandas(): |
| 2338 | + with _FakeNoPandas(): |
2356 | 2339 | epochs_read = read_epochs(temp_fname)
|
2357 | 2340 | assert isinstance(epochs_read.metadata, list)
|
2358 | 2341 | assert isinstance(epochs_read.metadata[0], dict)
|
|
0 commit comments