[med-svn] [python-mne] 318/376: ENH : using local imports in tests
Yaroslav Halchenko
debian at onerussian.com
Fri Nov 27 17:23:15 UTC 2015
This is an automated email from the git hooks/post-receive script.
yoh pushed a commit to annotated tag v0.1
in repository python-mne.
commit a3920a521397f66e3b1bfd5c7e71db99bc910108
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date: Thu Jul 7 12:26:11 2011 +0200
ENH : using local imports in tests
---
mne/tests/test_event.py | 15 ++++++++-------
mne/tests/test_forward.py | 10 +++++-----
mne/tests/test_label.py | 6 +++---
mne/tests/test_source_estimate.py | 19 +++++++++----------
mne/tests/test_source_space.py | 10 ++++------
mne/tests/test_surface.py | 8 ++++----
mne/tests/test_viz.py | 6 +++---
7 files changed, 36 insertions(+), 38 deletions(-)
diff --git a/mne/tests/test_event.py b/mne/tests/test_event.py
index c15f506..965fb61 100644
--- a/mne/tests/test_event.py
+++ b/mne/tests/test_event.py
@@ -2,7 +2,8 @@ import os.path as op
from numpy.testing import assert_array_almost_equal
-import mne
+from .. import read_events, write_events, find_events
+from .. import fiff
fname = op.join(op.dirname(__file__), '..', 'fiff', 'tests', 'data',
@@ -15,16 +16,16 @@ raw_fname = op.join(op.dirname(__file__), '..', 'fiff', 'tests', 'data',
def test_io_events():
"""Test IO for events
"""
- events = mne.read_events(fname)
- mne.write_events('events.fif', events)
- events2 = mne.read_events('events.fif')
+ events = read_events(fname)
+ write_events('events.fif', events)
+ events2 = read_events('events.fif')
assert_array_almost_equal(events, events2)
def test_find_events():
"""Test find events in raw file
"""
- events = mne.read_events(fname)
- raw = mne.fiff.Raw(raw_fname)
- events2 = mne.find_events(raw)
+ events = read_events(fname)
+ raw = fiff.Raw(raw_fname)
+ events2 = find_events(raw)
assert_array_almost_equal(events, events2)
diff --git a/mne/tests/test_forward.py b/mne/tests/test_forward.py
index 4fc6bda..8fb9222 100644
--- a/mne/tests/test_forward.py
+++ b/mne/tests/test_forward.py
@@ -2,8 +2,8 @@ import os.path as op
# from numpy.testing import assert_array_almost_equal, assert_equal
-import mne
-from mne.datasets import sample
+from ..datasets import sample
+from .. import read_forward_solution
examples_folder = op.join(op.dirname(__file__), '..', '..', 'examples')
data_path = sample.data_path(examples_folder)
@@ -13,8 +13,8 @@ fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis-meg-oct-6-fwd.fif')
def test_io_forward():
"""Test IO for forward solutions
"""
- fwd = mne.read_forward_solution(fname)
- fwd = mne.read_forward_solution(fname, force_fixed=True)
- fwd = mne.read_forward_solution(fname, surf_ori=True)
+ fwd = read_forward_solution(fname)
+ fwd = read_forward_solution(fname, force_fixed=True)
+ fwd = read_forward_solution(fname, surf_ori=True)
leadfield = fwd['sol']['data']
# XXX : test something
diff --git a/mne/tests/test_label.py b/mne/tests/test_label.py
index 54fe29b..b5f6d14 100644
--- a/mne/tests/test_label.py
+++ b/mne/tests/test_label.py
@@ -1,7 +1,7 @@
import os.path as op
-import mne
-from mne.datasets import sample
+from ..datasets import sample
+from .. import label_time_courses
examples_folder = op.join(op.dirname(__file__), '..', '..', 'examples')
data_path = sample.data_path(examples_folder)
@@ -14,7 +14,7 @@ def test_label_io_and_time_course_estimates():
"""Test IO for STC files
"""
- values, times, vertices = mne.label_time_courses(label_fname, stc_fname)
+ values, times, vertices = label_time_courses(label_fname, stc_fname)
assert len(times) == values.shape[1]
assert len(vertices) == values.shape[0]
diff --git a/mne/tests/test_source_estimate.py b/mne/tests/test_source_estimate.py
index ef75230..63f2319 100644
--- a/mne/tests/test_source_estimate.py
+++ b/mne/tests/test_source_estimate.py
@@ -3,10 +3,10 @@ import os.path as op
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
-import mne
-from mne.datasets import sample
-from mne import stats
-from mne.source_estimate import spatio_temporal_tris_connectivity, \
+from ..datasets import sample
+from .. import stats
+from .. import read_stc, write_stc, SourceEstimate, morph_data
+from ..source_estimate import spatio_temporal_tris_connectivity, \
spatio_temporal_src_connectivity
@@ -18,11 +18,11 @@ fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis-meg-lh.stc')
def test_io_stc():
"""Test IO for STC files
"""
- stc = mne.read_stc(fname)
+ stc = read_stc(fname)
- mne.write_stc("tmp.stc", stc['tmin'], stc['tstep'],
+ write_stc("tmp.stc", stc['tmin'], stc['tstep'],
stc['vertices'], stc['data'])
- stc2 = mne.read_stc("tmp.stc")
+ stc2 = read_stc("tmp.stc")
assert_array_almost_equal(stc['data'], stc2['data'])
assert_array_almost_equal(stc['tmin'], stc2['tmin'])
@@ -33,12 +33,11 @@ def test_io_stc():
def test_morph_data():
"""Test morphing of data
"""
- import mne
subject_from = 'sample'
subject_to = 'morph'
fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis-meg')
- stc_from = mne.SourceEstimate(fname)
- stc_to = mne.morph_data(subject_from, subject_to, stc_from,
+ stc_from = SourceEstimate(fname)
+ stc_to = morph_data(subject_from, subject_to, stc_from,
grade=3, smooth=12)
stc_to.save('%s_audvis-meg' % subject_to)
diff --git a/mne/tests/test_source_space.py b/mne/tests/test_source_space.py
index 693e3b7..76f81d9 100644
--- a/mne/tests/test_source_space.py
+++ b/mne/tests/test_source_space.py
@@ -1,9 +1,7 @@
import os.path as op
-# from numpy.testing import assert_array_almost_equal
-
-import mne
-from mne.datasets import sample
+from ..datasets import sample
+from .. import read_source_spaces
examples_folder = op.join(op.dirname(__file__), '..', '..', 'examples')
data_path = sample.data_path(examples_folder)
@@ -13,8 +11,8 @@ fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis-eeg-oct-6p-fwd.fif')
def test_read_source_spaces():
"""Testing reading of source space meshes
"""
- src = mne.read_source_spaces(fname, add_geom=False)
- src = mne.read_source_spaces(fname, add_geom=True)
+ src = read_source_spaces(fname, add_geom=False)
+ src = read_source_spaces(fname, add_geom=True)
# 3D source space
lh_points = src[0]['rr']
diff --git a/mne/tests/test_surface.py b/mne/tests/test_surface.py
index 96bd526..232b7e0 100644
--- a/mne/tests/test_surface.py
+++ b/mne/tests/test_surface.py
@@ -2,8 +2,8 @@ import os.path as op
# from numpy.testing import assert_array_almost_equal
-import mne
-from mne.datasets import sample
+from ..datasets import sample
+from .. import read_bem_surfaces
examples_folder = op.join(op.dirname(__file__), '..', '..', 'examples')
data_path = sample.data_path(examples_folder)
@@ -14,6 +14,6 @@ fname = op.join(data_path, 'subjects', 'sample', 'bem',
def test_io_bem_surfaces():
"""Testing reading of bem surfaces
"""
- surf = mne.read_bem_surfaces(fname, add_geom=False)
- surf = mne.read_bem_surfaces(fname, add_geom=True)
+ surf = read_bem_surfaces(fname, add_geom=False)
+ surf = read_bem_surfaces(fname, add_geom=True)
print "Number of surfaces : %d" % len(surf)
diff --git a/mne/tests/test_viz.py b/mne/tests/test_viz.py
index 1d3455c..2e6999a 100644
--- a/mne/tests/test_viz.py
+++ b/mne/tests/test_viz.py
@@ -1,8 +1,8 @@
import os.path as op
-from mne import fiff
-from mne.layouts import Layout
-from mne.viz import plot_topo
+from .. import fiff
+from ..layouts import Layout
+from ..viz import plot_topo
fname = op.join(op.dirname(__file__), '..', 'fiff', 'tests', 'data',
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-mne.git
More information about the debian-med-commit
mailing list