-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TEST: use fixture and parametrize in BrainVision date tests #6623
Conversation
There's only a couple things: I would be fine in merging this as is (if the But I would like to try to move the logic from the parametrization to the fixture. (at least as sport to see if it's more readable). I can give it a shot after #6621 |
@sappelhoff have you checked how other projects mock files? It might be worth to take a look. |
A good chunk has been removed down there indeed, good work. 👍 |
Codecov Report
@@ Coverage Diff @@
## master #6623 +/- ##
=========================================
- Coverage 89.41% 89.4% -0.01%
=========================================
Files 416 416
Lines 75140 75119 -21
Branches 12347 12352 +5
=========================================
- Hits 67184 67163 -21
- Misses 5123 5124 +1
+ Partials 2833 2832 -1 |
@sappelhoff I made you a PR sappelhoff#2 |
* UPS: this is not working. * wip * fix * FIX: Allow for testing meas_date == None
I would split the content string when it's larger than 80characters and
drop the noqa. Otherwise looks good to me.
…On Fri, Aug 2, 2019, 23:33 Stefan Appelhoff ***@***.***> wrote:
@sappelhoff <https://github.com/sappelhoff> requested your review on:
#6623 <#6623> TEST: use
fixture and parametrize in BrainVision date tests.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#6623?email_source=notifications&email_token=ABVX5Y2BORJXX7KAFY7VVJLQCSR3FA5CNFSM4II5RHE2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOS3M2UZY#event-2530847335>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABVX5YZBTJHNOIQ3IUALT7TQCSR3FANCNFSM4II5RHEQ>
.
|
import os.path as op | ||
from os import unlink | ||
from collections import OrderedDict as odict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid changing names of builtin objects. It makes your code harder to read. I hard to scroll the file to understand the code below
@massich can you help me? I have no clue about this Travis error ... |
Travis is breaking for the python 3.5 environment. Most likely to be backward compat we need a casting. I tried but I runned into #6627. |
I've no idea what is running in travis. In my system the problem was that ordered dict was not doing what you wrote. The order of construction was not presreved. So I just changed this : - return OrderedDict(vhdr_fname=vhdr_fname, vmrk_fname=vmrk_fname,
- lines=lines)
+ return vhdr_fname, vmrk_fname, lines
...
- vhdr_fname, vmrk_fname, lines = _mocked_meas_date_data.values()
+ vhdr_fname, vmrk_fname, lines = _mocked_meas_date_data
...
- yield OrderedDict(vhdr_fname=vhdr_fname,
- expected_meas_date=request.param['meas_date'],
- expected_meas_date_repr=request.param['meas_date_repr'])
+ yield (
+ vhdr_fname, request.param['meas_date'], request.param['meas_date_repr']
+ )
...
- vhdr_f, expected_meas, expected_meas_repr = mocked_meas_date_file.values()
+ vhdr_f, expected_meas, expected_meas_repr = mocked_meas_date_file Her is a full trace showing my system, the error and the fix behavior: click me~/code/mne-python base*
(mne35) ❯ python -c "import mne; mne.sys_info()"
Platform: Linux-4.15.0-46-generic-x86_64-with-debian-buster-sid
Python: 3.5.5 | packaged by conda-forge | (default, Jul 23 2018, 23:45:43) [GCC 4.8.2 20140120 (Red Hat 4.8.2-15)]
Executable: /home/sik/miniconda3/envs/mne35/bin/python
CPU: x86_64: 4 cores
Memory: Unavailable (requires "psutil" package)
mne: 0.19.dev0
numpy: 1.11.2 {lapack=/home/sik/miniconda3/envs/mne35/include, blas=/home/sik/miniconda3/envs/mne35/include}
scipy: 0.17.1
matplotlib: 1.5.3 {backend=Qt5Agg}
sklearn: 0.18.1
nibabel: Not found
mayavi: Not found
cupy: Not found
pandas: 0.18.0
dipy: Not found
~/code/mne-python base
(mne35) ❯ git checkout base~1
Note: checking out 'base~1'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 9af8872c0 squash 6623
~/code/mne-python 9af8872...
(mne35) ❯ pytest ./mne/io/brainvision/tests/test_brainvision.py -k meas_date -v
Test session starts (platform: linux, Python 3.5.5, pytest 3.8.1, pytest-sugar 0.9.2)
cachedir: .pytest_cache
rootdir: /home/sik/code/mne-python, inifile: setup.cfg
plugins: sugar-0.9.2, faulthandler-1.5.0, cov-2.6.0
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― test_meas_date[mocked_meas_date_file0] ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
mocked_meas_date_file = OrderedDict([('expected_meas_date_repr', '2013-11-13 16:14:03 GM'), ('vhdr_fname', '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'), ('expected_meas_date', [1384359243, 794231])])
def test_meas_date(mocked_meas_date_file):
"""Test successful extraction of measurement date."""
vhdr_f, expected_meas, expected_meas_repr = mocked_meas_date_file.values()
> raw = read_raw_brainvision(vhdr_f)
expected_meas = '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'
expected_meas_repr = [1384359243, 794231]
mocked_meas_date_file = OrderedDict([('expected_meas_date_repr', '2013-11-13 16:14:03 GM'), ('vhdr_fname', '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'), ('expected_meas_date', [1384359243, 794231])])
vhdr_f = '2013-11-13 16:14:03 GM'
mne/io/brainvision/tests/test_brainvision.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mne/io/brainvision/brainvision.py:824: in read_raw_brainvision
verbose=verbose)
</home/sik/code/mne-python/mne/externals/decorator.py:decorator-gen-146>:2: in __init__
???
mne/utils/_logging.py:89: in wrapper
return function(*args, **kwargs)
mne/io/brainvision/brainvision.py:68: in __init__
orig_units) = _get_vhdr_info(vhdr_fname, eog, misc, scale, montage)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
vhdr_fname = '/home/sik/code/mne-python/2013-11-13 16:14:03 GM', eog = ('HEOGL', 'HEOGR', 'VEOGb'), misc = 'auto', scale = 1.0, montage = 'deprecated'
def _get_vhdr_info(vhdr_fname, eog, misc, scale, montage):
"""Extract all the information from the header file.
Parameters
----------
vhdr_fname : str
Raw EEG header to be read.
eog : list of str
Names of channels that should be designated EOG channels. Names should
correspond to the vhdr file.
misc : list or tuple of str | 'auto'
Names of channels or list of indices that should be designated
MISC channels. Values should correspond to the electrodes
in the vhdr file. If 'auto', units in vhdr file are used for inferring
misc channels. Default is ``'auto'``.
scale : float
The scaling factor for EEG data. Unless specified otherwise by
header file, units are in microvolts. Default scale factor is 1.
montage : str | None | instance of Montage
Path or instance of montage containing electrode positions. If None,
read sensor locations from header file if present, otherwise (0, 0, 0).
See the documentation of :func:`mne.channels.read_montage` for more
information.
Returns
-------
info : Info
The measurement info.
data_fname : str
Path to the binary data file.
fmt : str
The format of the binary data file.
order : str
Orientation of the binary data.
n_samples : int
Number of data points in the binary data file.
mrk_fname : str
Path to the marker file.
montage : Montage
Coordinates of the channels, if present in the header file.
orig_units : dict
Dictionary mapping channel names to their units as specified in
the header file. Example: {'FC1': 'nV'}
"""
scale = float(scale)
ext = op.splitext(vhdr_fname)[-1]
if ext != '.vhdr':
raise IOError("The header file must be given to read the data, "
> "not a file with extension '%s'." % ext)
E OSError: The header file must be given to read the data, not a file with extension ''.
eog = ('HEOGL', 'HEOGR', 'VEOGb')
ext = ''
misc = 'auto'
montage = 'deprecated'
scale = 1.0
vhdr_fname = '/home/sik/code/mne-python/2013-11-13 16:14:03 GM'
mne/io/brainvision/brainvision.py:437: OSError
mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file0] ⨯ 14% █▌
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― test_meas_date[mocked_meas_date_file1] ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
mocked_meas_date_file = OrderedDict([('expected_meas_date_repr', '2007-07-16 12:22:40 GM'), ('vhdr_fname', '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'), ('expected_meas_date', [1184588560, 937453])])
def test_meas_date(mocked_meas_date_file):
"""Test successful extraction of measurement date."""
vhdr_f, expected_meas, expected_meas_repr = mocked_meas_date_file.values()
> raw = read_raw_brainvision(vhdr_f)
expected_meas = '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'
expected_meas_repr = [1184588560, 937453]
mocked_meas_date_file = OrderedDict([('expected_meas_date_repr', '2007-07-16 12:22:40 GM'), ('vhdr_fname', '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'), ('expected_meas_date', [1184588560, 937453])])
vhdr_f = '2007-07-16 12:22:40 GM'
mne/io/brainvision/tests/test_brainvision.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mne/io/brainvision/brainvision.py:824: in read_raw_brainvision
verbose=verbose)
</home/sik/code/mne-python/mne/externals/decorator.py:decorator-gen-146>:2: in __init__
???
mne/utils/_logging.py:89: in wrapper
return function(*args, **kwargs)
mne/io/brainvision/brainvision.py:68: in __init__
orig_units) = _get_vhdr_info(vhdr_fname, eog, misc, scale, montage)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
vhdr_fname = '/home/sik/code/mne-python/2007-07-16 12:22:40 GM', eog = ('HEOGL', 'HEOGR', 'VEOGb'), misc = 'auto', scale = 1.0, montage = 'deprecated'
def _get_vhdr_info(vhdr_fname, eog, misc, scale, montage):
"""Extract all the information from the header file.
Parameters
----------
vhdr_fname : str
Raw EEG header to be read.
eog : list of str
Names of channels that should be designated EOG channels. Names should
correspond to the vhdr file.
misc : list or tuple of str | 'auto'
Names of channels or list of indices that should be designated
MISC channels. Values should correspond to the electrodes
in the vhdr file. If 'auto', units in vhdr file are used for inferring
misc channels. Default is ``'auto'``.
scale : float
The scaling factor for EEG data. Unless specified otherwise by
header file, units are in microvolts. Default scale factor is 1.
montage : str | None | instance of Montage
Path or instance of montage containing electrode positions. If None,
read sensor locations from header file if present, otherwise (0, 0, 0).
See the documentation of :func:`mne.channels.read_montage` for more
information.
Returns
-------
info : Info
The measurement info.
data_fname : str
Path to the binary data file.
fmt : str
The format of the binary data file.
order : str
Orientation of the binary data.
n_samples : int
Number of data points in the binary data file.
mrk_fname : str
Path to the marker file.
montage : Montage
Coordinates of the channels, if present in the header file.
orig_units : dict
Dictionary mapping channel names to their units as specified in
the header file. Example: {'FC1': 'nV'}
"""
scale = float(scale)
ext = op.splitext(vhdr_fname)[-1]
if ext != '.vhdr':
raise IOError("The header file must be given to read the data, "
> "not a file with extension '%s'." % ext)
E OSError: The header file must be given to read the data, not a file with extension ''.
eog = ('HEOGL', 'HEOGR', 'VEOGb')
ext = ''
misc = 'auto'
montage = 'deprecated'
scale = 1.0
vhdr_fname = '/home/sik/code/mne-python/2007-07-16 12:22:40 GM'
mne/io/brainvision/brainvision.py:437: OSError
mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file1] ⨯ 29% ██▉
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― test_meas_date[mocked_meas_date_file2] ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
mocked_meas_date_file = OrderedDict([('expected_meas_date_repr', '2007-07-16 12:22:40 GM'), ('vhdr_fname', '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'), ('expected_meas_date', [1184588560, 937453])])
def test_meas_date(mocked_meas_date_file):
"""Test successful extraction of measurement date."""
vhdr_f, expected_meas, expected_meas_repr = mocked_meas_date_file.values()
> raw = read_raw_brainvision(vhdr_f)
expected_meas = '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'
expected_meas_repr = [1184588560, 937453]
mocked_meas_date_file = OrderedDict([('expected_meas_date_repr', '2007-07-16 12:22:40 GM'), ('vhdr_fname', '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'), ('expected_meas_date', [1184588560, 937453])])
vhdr_f = '2007-07-16 12:22:40 GM'
mne/io/brainvision/tests/test_brainvision.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mne/io/brainvision/brainvision.py:824: in read_raw_brainvision
verbose=verbose)
</home/sik/code/mne-python/mne/externals/decorator.py:decorator-gen-146>:2: in __init__
???
mne/utils/_logging.py:89: in wrapper
return function(*args, **kwargs)
mne/io/brainvision/brainvision.py:68: in __init__
orig_units) = _get_vhdr_info(vhdr_fname, eog, misc, scale, montage)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
vhdr_fname = '/home/sik/code/mne-python/2007-07-16 12:22:40 GM', eog = ('HEOGL', 'HEOGR', 'VEOGb'), misc = 'auto', scale = 1.0, montage = 'deprecated'
def _get_vhdr_info(vhdr_fname, eog, misc, scale, montage):
"""Extract all the information from the header file.
Parameters
----------
vhdr_fname : str
Raw EEG header to be read.
eog : list of str
Names of channels that should be designated EOG channels. Names should
correspond to the vhdr file.
misc : list or tuple of str | 'auto'
Names of channels or list of indices that should be designated
MISC channels. Values should correspond to the electrodes
in the vhdr file. If 'auto', units in vhdr file are used for inferring
misc channels. Default is ``'auto'``.
scale : float
The scaling factor for EEG data. Unless specified otherwise by
header file, units are in microvolts. Default scale factor is 1.
montage : str | None | instance of Montage
Path or instance of montage containing electrode positions. If None,
read sensor locations from header file if present, otherwise (0, 0, 0).
See the documentation of :func:`mne.channels.read_montage` for more
information.
Returns
-------
info : Info
The measurement info.
data_fname : str
Path to the binary data file.
fmt : str
The format of the binary data file.
order : str
Orientation of the binary data.
n_samples : int
Number of data points in the binary data file.
mrk_fname : str
Path to the marker file.
montage : Montage
Coordinates of the channels, if present in the header file.
orig_units : dict
Dictionary mapping channel names to their units as specified in
the header file. Example: {'FC1': 'nV'}
"""
scale = float(scale)
ext = op.splitext(vhdr_fname)[-1]
if ext != '.vhdr':
raise IOError("The header file must be given to read the data, "
> "not a file with extension '%s'." % ext)
E OSError: The header file must be given to read the data, not a file with extension ''.
eog = ('HEOGL', 'HEOGR', 'VEOGb')
ext = ''
misc = 'auto'
montage = 'deprecated'
scale = 1.0
vhdr_fname = '/home/sik/code/mne-python/2007-07-16 12:22:40 GM'
mne/io/brainvision/brainvision.py:437: OSError
mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file2] ⨯ 43% ████▍
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― test_meas_date[mocked_meas_date_file3] ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
mocked_meas_date_file = OrderedDict([('expected_meas_date_repr', 'unspecified'), ('vhdr_fname', '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'), ('expected_meas_date', None)])
def test_meas_date(mocked_meas_date_file):
"""Test successful extraction of measurement date."""
vhdr_f, expected_meas, expected_meas_repr = mocked_meas_date_file.values()
> raw = read_raw_brainvision(vhdr_f)
expected_meas = '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'
expected_meas_repr = None
mocked_meas_date_file = OrderedDict([('expected_meas_date_repr', 'unspecified'), ('vhdr_fname', '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'), ('expected_meas_date', None)])
vhdr_f = 'unspecified'
mne/io/brainvision/tests/test_brainvision.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mne/io/brainvision/brainvision.py:824: in read_raw_brainvision
verbose=verbose)
</home/sik/code/mne-python/mne/externals/decorator.py:decorator-gen-146>:2: in __init__
???
mne/utils/_logging.py:89: in wrapper
return function(*args, **kwargs)
mne/io/brainvision/brainvision.py:68: in __init__
orig_units) = _get_vhdr_info(vhdr_fname, eog, misc, scale, montage)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
vhdr_fname = '/home/sik/code/mne-python/unspecified', eog = ('HEOGL', 'HEOGR', 'VEOGb'), misc = 'auto', scale = 1.0, montage = 'deprecated'
def _get_vhdr_info(vhdr_fname, eog, misc, scale, montage):
"""Extract all the information from the header file.
Parameters
----------
vhdr_fname : str
Raw EEG header to be read.
eog : list of str
Names of channels that should be designated EOG channels. Names should
correspond to the vhdr file.
misc : list or tuple of str | 'auto'
Names of channels or list of indices that should be designated
MISC channels. Values should correspond to the electrodes
in the vhdr file. If 'auto', units in vhdr file are used for inferring
misc channels. Default is ``'auto'``.
scale : float
The scaling factor for EEG data. Unless specified otherwise by
header file, units are in microvolts. Default scale factor is 1.
montage : str | None | instance of Montage
Path or instance of montage containing electrode positions. If None,
read sensor locations from header file if present, otherwise (0, 0, 0).
See the documentation of :func:`mne.channels.read_montage` for more
information.
Returns
-------
info : Info
The measurement info.
data_fname : str
Path to the binary data file.
fmt : str
The format of the binary data file.
order : str
Orientation of the binary data.
n_samples : int
Number of data points in the binary data file.
mrk_fname : str
Path to the marker file.
montage : Montage
Coordinates of the channels, if present in the header file.
orig_units : dict
Dictionary mapping channel names to their units as specified in
the header file. Example: {'FC1': 'nV'}
"""
scale = float(scale)
ext = op.splitext(vhdr_fname)[-1]
if ext != '.vhdr':
raise IOError("The header file must be given to read the data, "
> "not a file with extension '%s'." % ext)
E OSError: The header file must be given to read the data, not a file with extension ''.
eog = ('HEOGL', 'HEOGR', 'VEOGb')
ext = ''
misc = 'auto'
montage = 'deprecated'
scale = 1.0
vhdr_fname = '/home/sik/code/mne-python/unspecified'
mne/io/brainvision/brainvision.py:437: OSError
mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file3] ⨯ 57% █████▊
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― test_meas_date[mocked_meas_date_file4] ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
mocked_meas_date_file = OrderedDict([('expected_meas_date_repr', 'unspecified'), ('vhdr_fname', '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'), ('expected_meas_date', None)])
def test_meas_date(mocked_meas_date_file):
"""Test successful extraction of measurement date."""
vhdr_f, expected_meas, expected_meas_repr = mocked_meas_date_file.values()
> raw = read_raw_brainvision(vhdr_f)
expected_meas = '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'
expected_meas_repr = None
mocked_meas_date_file = OrderedDict([('expected_meas_date_repr', 'unspecified'), ('vhdr_fname', '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'), ('expected_meas_date', None)])
vhdr_f = 'unspecified'
mne/io/brainvision/tests/test_brainvision.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mne/io/brainvision/brainvision.py:824: in read_raw_brainvision
verbose=verbose)
</home/sik/code/mne-python/mne/externals/decorator.py:decorator-gen-146>:2: in __init__
???
mne/utils/_logging.py:89: in wrapper
return function(*args, **kwargs)
mne/io/brainvision/brainvision.py:68: in __init__
orig_units) = _get_vhdr_info(vhdr_fname, eog, misc, scale, montage)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
vhdr_fname = '/home/sik/code/mne-python/unspecified', eog = ('HEOGL', 'HEOGR', 'VEOGb'), misc = 'auto', scale = 1.0, montage = 'deprecated'
def _get_vhdr_info(vhdr_fname, eog, misc, scale, montage):
"""Extract all the information from the header file.
Parameters
----------
vhdr_fname : str
Raw EEG header to be read.
eog : list of str
Names of channels that should be designated EOG channels. Names should
correspond to the vhdr file.
misc : list or tuple of str | 'auto'
Names of channels or list of indices that should be designated
MISC channels. Values should correspond to the electrodes
in the vhdr file. If 'auto', units in vhdr file are used for inferring
misc channels. Default is ``'auto'``.
scale : float
The scaling factor for EEG data. Unless specified otherwise by
header file, units are in microvolts. Default scale factor is 1.
montage : str | None | instance of Montage
Path or instance of montage containing electrode positions. If None,
read sensor locations from header file if present, otherwise (0, 0, 0).
See the documentation of :func:`mne.channels.read_montage` for more
information.
Returns
-------
info : Info
The measurement info.
data_fname : str
Path to the binary data file.
fmt : str
The format of the binary data file.
order : str
Orientation of the binary data.
n_samples : int
Number of data points in the binary data file.
mrk_fname : str
Path to the marker file.
montage : Montage
Coordinates of the channels, if present in the header file.
orig_units : dict
Dictionary mapping channel names to their units as specified in
the header file. Example: {'FC1': 'nV'}
"""
scale = float(scale)
ext = op.splitext(vhdr_fname)[-1]
if ext != '.vhdr':
raise IOError("The header file must be given to read the data, "
> "not a file with extension '%s'." % ext)
E OSError: The header file must be given to read the data, not a file with extension ''.
eog = ('HEOGL', 'HEOGR', 'VEOGb')
ext = ''
misc = 'auto'
montage = 'deprecated'
scale = 1.0
vhdr_fname = '/home/sik/code/mne-python/unspecified'
mne/io/brainvision/brainvision.py:437: OSError
mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file4] ⨯ 71% ███████▎
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― test_meas_date[mocked_meas_date_file5] ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
mocked_meas_date_file = OrderedDict([('expected_meas_date_repr', 'unspecified'), ('vhdr_fname', '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'), ('expected_meas_date', None)])
def test_meas_date(mocked_meas_date_file):
"""Test successful extraction of measurement date."""
vhdr_f, expected_meas, expected_meas_repr = mocked_meas_date_file.values()
> raw = read_raw_brainvision(vhdr_f)
expected_meas = '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'
expected_meas_repr = None
mocked_meas_date_file = OrderedDict([('expected_meas_date_repr', 'unspecified'), ('vhdr_fname', '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'), ('expected_meas_date', None)])
vhdr_f = 'unspecified'
mne/io/brainvision/tests/test_brainvision.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mne/io/brainvision/brainvision.py:824: in read_raw_brainvision
verbose=verbose)
</home/sik/code/mne-python/mne/externals/decorator.py:decorator-gen-146>:2: in __init__
???
mne/utils/_logging.py:89: in wrapper
return function(*args, **kwargs)
mne/io/brainvision/brainvision.py:68: in __init__
orig_units) = _get_vhdr_info(vhdr_fname, eog, misc, scale, montage)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
vhdr_fname = '/home/sik/code/mne-python/unspecified', eog = ('HEOGL', 'HEOGR', 'VEOGb'), misc = 'auto', scale = 1.0, montage = 'deprecated'
def _get_vhdr_info(vhdr_fname, eog, misc, scale, montage):
"""Extract all the information from the header file.
Parameters
----------
vhdr_fname : str
Raw EEG header to be read.
eog : list of str
Names of channels that should be designated EOG channels. Names should
correspond to the vhdr file.
misc : list or tuple of str | 'auto'
Names of channels or list of indices that should be designated
MISC channels. Values should correspond to the electrodes
in the vhdr file. If 'auto', units in vhdr file are used for inferring
misc channels. Default is ``'auto'``.
scale : float
The scaling factor for EEG data. Unless specified otherwise by
header file, units are in microvolts. Default scale factor is 1.
montage : str | None | instance of Montage
Path or instance of montage containing electrode positions. If None,
read sensor locations from header file if present, otherwise (0, 0, 0).
See the documentation of :func:`mne.channels.read_montage` for more
information.
Returns
-------
info : Info
The measurement info.
data_fname : str
Path to the binary data file.
fmt : str
The format of the binary data file.
order : str
Orientation of the binary data.
n_samples : int
Number of data points in the binary data file.
mrk_fname : str
Path to the marker file.
montage : Montage
Coordinates of the channels, if present in the header file.
orig_units : dict
Dictionary mapping channel names to their units as specified in
the header file. Example: {'FC1': 'nV'}
"""
scale = float(scale)
ext = op.splitext(vhdr_fname)[-1]
if ext != '.vhdr':
raise IOError("The header file must be given to read the data, "
> "not a file with extension '%s'." % ext)
E OSError: The header file must be given to read the data, not a file with extension ''.
eog = ('HEOGL', 'HEOGR', 'VEOGb')
ext = ''
misc = 'auto'
montage = 'deprecated'
scale = 1.0
vhdr_fname = '/home/sik/code/mne-python/unspecified'
mne/io/brainvision/brainvision.py:437: OSError
mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file5] ⨯ 86% ████████▋
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― test_meas_date[mocked_meas_date_file6] ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
mocked_meas_date_file = OrderedDict([('expected_meas_date_repr', 'unspecified'), ('vhdr_fname', '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'), ('expected_meas_date', None)])
def test_meas_date(mocked_meas_date_file):
"""Test successful extraction of measurement date."""
vhdr_f, expected_meas, expected_meas_repr = mocked_meas_date_file.values()
> raw = read_raw_brainvision(vhdr_f)
expected_meas = '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'
expected_meas_repr = None
mocked_meas_date_file = OrderedDict([('expected_meas_date_repr', 'unspecified'), ('vhdr_fname', '/tmp/pytest-of-sik/pytest-40/brainvision_mocked_meas_date0/test.vhdr'), ('expected_meas_date', None)])
vhdr_f = 'unspecified'
mne/io/brainvision/tests/test_brainvision.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mne/io/brainvision/brainvision.py:824: in read_raw_brainvision
verbose=verbose)
</home/sik/code/mne-python/mne/externals/decorator.py:decorator-gen-146>:2: in __init__
???
mne/utils/_logging.py:89: in wrapper
return function(*args, **kwargs)
mne/io/brainvision/brainvision.py:68: in __init__
orig_units) = _get_vhdr_info(vhdr_fname, eog, misc, scale, montage)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
vhdr_fname = '/home/sik/code/mne-python/unspecified', eog = ('HEOGL', 'HEOGR', 'VEOGb'), misc = 'auto', scale = 1.0, montage = 'deprecated'
def _get_vhdr_info(vhdr_fname, eog, misc, scale, montage):
"""Extract all the information from the header file.
Parameters
----------
vhdr_fname : str
Raw EEG header to be read.
eog : list of str
Names of channels that should be designated EOG channels. Names should
correspond to the vhdr file.
misc : list or tuple of str | 'auto'
Names of channels or list of indices that should be designated
MISC channels. Values should correspond to the electrodes
in the vhdr file. If 'auto', units in vhdr file are used for inferring
misc channels. Default is ``'auto'``.
scale : float
The scaling factor for EEG data. Unless specified otherwise by
header file, units are in microvolts. Default scale factor is 1.
montage : str | None | instance of Montage
Path or instance of montage containing electrode positions. If None,
read sensor locations from header file if present, otherwise (0, 0, 0).
See the documentation of :func:`mne.channels.read_montage` for more
information.
Returns
-------
info : Info
The measurement info.
data_fname : str
Path to the binary data file.
fmt : str
The format of the binary data file.
order : str
Orientation of the binary data.
n_samples : int
Number of data points in the binary data file.
mrk_fname : str
Path to the marker file.
montage : Montage
Coordinates of the channels, if present in the header file.
orig_units : dict
Dictionary mapping channel names to their units as specified in
the header file. Example: {'FC1': 'nV'}
"""
scale = float(scale)
ext = op.splitext(vhdr_fname)[-1]
if ext != '.vhdr':
raise IOError("The header file must be given to read the data, "
> "not a file with extension '%s'." % ext)
E OSError: The header file must be given to read the data, not a file with extension ''.
eog = ('HEOGL', 'HEOGR', 'VEOGb')
ext = ''
misc = 'auto'
montage = 'deprecated'
scale = 1.0
vhdr_fname = '/home/sik/code/mne-python/unspecified'
mne/io/brainvision/brainvision.py:437: OSError
mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file6] ⨯ 100% ██████████^C
------------------------------------------------------ generated xml file: /home/sik/code/mne-python/junit-results.xml ------------------------------------------------------
========================================================================== short test summary info ==========================================================================
FAIL mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file0]
FAIL mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file1]
FAIL mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file2]
FAIL mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file3]
FAIL mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file4]
FAIL mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file5]
FAIL mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file6]
========================================================================= slowest 20 test durations =========================================================================
0.21s setup mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file0]
0.00s teardown mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file6]
0.00s setup mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file3]
0.00s setup mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file4]
0.00s setup mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file5]
0.00s setup mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file1]
0.00s setup mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file2]
0.00s setup mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file6]
0.00s call mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file0]
0.00s call mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file4]
0.00s call mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file5]
0.00s call mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file3]
0.00s call mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file1]
0.00s call mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file2]
0.00s call mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file6]
0.00s teardown mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file0]
0.00s teardown mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file4]
0.00s teardown mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file2]
0.00s teardown mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file5]
0.00s teardown mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file1]
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/home/sik/miniconda3/envs/mne35/lib/python3.5/site-packages/coverage/parser.py:543: KeyboardInterrupt
(to show a full traceback on KeyboardInterrupt use --fulltrace)
Results (6.81s):
7 failed
- mne/io/brainvision/tests/test_brainvision.py:139 test_meas_date[mocked_meas_date_file0]
- mne/io/brainvision/tests/test_brainvision.py:139 test_meas_date[mocked_meas_date_file1]
- mne/io/brainvision/tests/test_brainvision.py:139 test_meas_date[mocked_meas_date_file2]
- mne/io/brainvision/tests/test_brainvision.py:139 test_meas_date[mocked_meas_date_file3]
- mne/io/brainvision/tests/test_brainvision.py:139 test_meas_date[mocked_meas_date_file4]
- mne/io/brainvision/tests/test_brainvision.py:139 test_meas_date[mocked_meas_date_file5]
- mne/io/brainvision/tests/test_brainvision.py:139 test_meas_date[mocked_meas_date_file6]
15 deselected
^C
~/code/mne-python 9af8872... 8s
(mne35) ❯ git ceckout base
git: 'ceckout' is not a git command. See 'git --help'.
The most similar command is
checkout
~/code/mne-python 9af8872...
(mne35) ❯ git checkout base
Previous HEAD position was 9af8872c0 squash 6623
Switched to branch 'base'
~/code/mne-python base
(mne35) ❯ pytest ./mne/io/brainvision/tests/test_brainvision.py -k meas_date -v
Test session starts (platform: linux, Python 3.5.5, pytest 3.8.1, pytest-sugar 0.9.2)
cachedir: .pytest_cache
rootdir: /home/sik/code/mne-python, inifile: setup.cfg
plugins: sugar-0.9.2, faulthandler-1.5.0, cov-2.6.0
mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file0] ✓ 14% █▌
mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file1] ✓ 29% ██▉
mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file2] ✓ 43% ████▍
mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file3] ✓ 57% █████▊
mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file4] ✓ 71% ███████▎
mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file5] ✓ 86% ████████▋
mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file6] ✓ 100% ██████████
------------------------------------------------------ generated xml file: /home/sik/code/mne-python/junit-results.xml ------------------------------------------------------
========================================================================= slowest 20 test durations =========================================================================
0.21s setup mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file0]
0.01s call mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file0]
0.01s call mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file6]
0.01s call mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file3]
0.01s call mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file4]
0.01s call mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file1]
0.01s call mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file2]
0.01s call mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file5]
0.00s teardown mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file6]
0.00s setup mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file4]
0.00s setup mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file2]
0.00s setup mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file3]
0.00s setup mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file6]
0.00s setup mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file1]
0.00s setup mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file5]
0.00s teardown mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file3]
0.00s teardown mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file1]
0.00s teardown mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file4]
0.00s teardown mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file0]
0.00s teardown mne/io/brainvision/tests/test_brainvision.py::test_meas_date[mocked_meas_date_file5]
Results (14.05s):
7 passed
15 deselected
~/code/mne-python base 15s
(mne35) ❯ |
Thanks @massich Do you know about the If you have a big chunk of code, simply wrap it like so: <details><summary> My summary </summary>
~~~
my code goes here
~~~
</details>
Rendered: My summary
|
Yes. But the code snippets get in a frame of about 20 lines don't they? At
least chrome renders like that. Maybe I've a plugin
…On Sat, Aug 3, 2019, 17:41 Stefan Appelhoff ***@***.***> wrote:
Thanks @massich <https://github.com/massich>
Do you know about the <details></details> HTML tag? It can make the
thread more readable if you want to paste a lot of stuff (e.g. error logs)
If you have a big chunk of code, simply wrap it like so:
<details><summary> My summary </summary>
~~~my code goes here~~~
</details>
Rendered:
My summary
my code goes here
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6623?email_source=notifications&email_token=ABVX5Y4Q2Y2GRWCKGZONYRLQCWRK3A5CNFSM4II5RHE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3PQWLA#issuecomment-517933868>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABVX5Y5D3UTKRRC3RESGEQDQCWRK3ANCNFSM4II5RHEQ>
.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job. merging now.
fixes #6611 (comment)