<s> import os <EOL> import warnings <EOL> import numpy as np <EOL> from numpy . testing import assert_array_equal <EOL> from nose . tools import assert_true , assert_false <EOL> from mne . io . kit . tests import data_dir as kit_data_dir <EOL> from mne . io . kit import read_mrk <EOL> from mne . utils import _TempDir , requires_traits , run_tests_if_main <EOL> mrk_pre_path = os . path . join ( kit_data_dir , '<STR_LIT>' ) <EOL> mrk_post_path = os . path . join ( kit_data_dir , '<STR_LIT>' ) <EOL> mrk_avg_path = os . path . join ( kit_data_dir , '<STR_LIT>' ) <EOL> warnings . simplefilter ( '<STR_LIT>' ) <EOL> @ requires_traits <EOL> def test_combine_markers_model ( ) : <EOL> """<STR_LIT>""" <EOL> from mne . gui . _marker_gui import CombineMarkersModel , CombineMarkersPanel <EOL> tempdir = _TempDir ( ) <EOL> tgt_fname = os . path . join ( tempdir , '<STR_LIT>' ) <EOL> model = CombineMarkersModel ( ) <EOL> assert_false ( model . mrk3 . can_save ) <EOL> model . mrk1 . file = mrk_pre_path <EOL> assert_true ( model . mrk3 . can_save ) <EOL> assert_array_equal ( model . mrk3 . points , model . mrk1 . points ) <EOL> model . mrk2 . file = mrk_pre_path <EOL> assert_array_equal ( model . mrk3 . points , model . mrk1 . points ) <EOL> model . mrk2 . clear = True <EOL> model . mrk2 . file = mrk_post_path <EOL> assert_true ( np . any ( model . mrk3 . points ) ) <EOL> points_interpolate_mrk1_mrk2 = model . mrk3 . points <EOL> model . mrk3 . method = '<STR_LIT>' <EOL> mrk_avg = read_mrk ( mrk_avg_path ) <EOL> assert_array_equal ( model . mrk3 . points , mrk_avg ) <EOL> model . mrk2 . clear = True <EOL> assert_array_equal ( model . mrk1 . points , model . mrk3 . points ) <EOL> model . mrk2 . file = mrk_post_path <EOL> model . mrk3 . save ( tgt_fname ) <EOL> mrk_io = read_mrk ( tgt_fname ) <EOL> assert_array_equal ( mrk_io , model . mrk3 . points ) <EOL> model . mrk1 . use = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] <EOL> assert_array_equal ( model . mrk3 . points [ <NUM_LIT:0> ] , model . mrk2 . points [ <NUM_LIT:0> ] ) <EOL> assert_array_equal ( model . mrk3 . points [ <NUM_LIT:1> : ] , mrk_avg [ <NUM_LIT:1> : ] ) <EOL> model . clear = True <EOL> model . mrk1 . file = mrk_pre_path <EOL> model . mrk2 . file = mrk_post_path <EOL> assert_array_equal ( model . mrk3 . points , points_interpolate_mrk1_mrk2 ) <EOL> os . environ [ '<STR_LIT>' ] = '<STR_LIT:true>' <EOL> try : <EOL> with warnings . catch_warnings ( record = True ) : <EOL> warnings . simplefilter ( '<STR_LIT>' ) <EOL> CombineMarkersPanel ( ) <EOL> finally : <EOL> del os . environ [ '<STR_LIT>' ] <EOL> run_tests_if_main ( ) </s>
