#NEWLINE# @ slow_test #NEWLINE# @ testing . requires_testing_data #NEWLINE# @ requires_PIL #NEWLINE# def test_render_report( ) : #NEWLINE# #INDENT# 'Test rendering -*.fif files for mne report.\n    ' #NEWLINE# tempdir = _TempDir ( ) #NEWLINE# raw_fname_new = op . join ( tempdir , 'temp_raw.fif' ) #NEWLINE# event_fname_new = op . join ( tempdir , 'temp_raw-eve.fif' ) #NEWLINE# cov_fname_new = op . join ( tempdir , 'temp_raw-cov.fif' ) #NEWLINE# fwd_fname_new = op . join ( tempdir , 'temp_raw-fwd.fif' ) #NEWLINE# inv_fname_new = op . join ( tempdir , 'temp_raw-inv.fif' ) #NEWLINE# for ( a , b ) in [ [ raw_fname , raw_fname_new ] , [ event_fname , event_fname_new ] , [ cov_fname , cov_fname_new ] , [ fwd_fname , inv_fname_new ] , [ inv_fname , inv_fname_new ] ] : #NEWLINE# #INDENT# shutil . copyfile ( a , b ) #NEWLINE# #UNINDENT# epochs_fname = op . join ( tempdir , 'temp-epo.fif' ) #NEWLINE# evoked_fname = op . join ( tempdir , 'temp-ave.fif' ) #NEWLINE# raw = Raw ( raw_fname_new ) #NEWLINE# picks = pick_types ( raw . info , meg = 'mag' , eeg = False ) #NEWLINE# epochs = Epochs ( raw , read_events ( event_fname ) , 1 , ( - 0.2 ) , 0.2 , picks = picks ) #NEWLINE# epochs . save ( epochs_fname ) #NEWLINE# epochs . average ( ) . save ( evoked_fname ) #NEWLINE# report = Report ( info_fname = raw_fname_new , subjects_dir = subjects_dir ) #NEWLINE# if sys . version . startswith ( '3.5' ) : #NEWLINE# #INDENT# raise SkipTest ( 'Python 3.5 and mpl have unresolved issues' ) #NEWLINE# #UNINDENT# with warnings . catch_warnings ( record = True ) as w : #NEWLINE# #INDENT# warnings . simplefilter ( 'always' ) #NEWLINE# report . parse_folder ( data_path = tempdir , on_error = 'raise' ) #NEWLINE# #UNINDENT# assert_true ( ( len ( w ) >= 1 ) ) #NEWLINE# fnames = glob . glob ( op . join ( tempdir , '*.fif' ) ) #NEWLINE# for fname in fnames : #NEWLINE# #INDENT# assert_true ( ( op . basename ( fname ) in [ op . basename ( x ) for x in report . fnames ] ) ) #NEWLINE# assert_true ( ( '' . join ( report . html ) . find ( op . basename ( fname ) ) != ( - 1 ) ) ) #NEWLINE# #UNINDENT# assert_equal ( len ( report . fnames ) , len ( fnames ) ) #NEWLINE# assert_equal ( len ( report . html ) , len ( report . fnames ) ) #NEWLINE# report . data_path = tempdir #NEWLINE# report . save ( fname = op . join ( tempdir , 'report.html' ) , open_browser = False ) #NEWLINE# assert_true ( op . isfile ( op . join ( tempdir , 'report.html' ) ) ) #NEWLINE# assert_equal ( len ( report . html ) , len ( fnames ) ) #NEWLINE# assert_equal ( len ( report . html ) , len ( report . fnames ) ) #NEWLINE# report . save ( fname = op . join ( tempdir , 'report2.html' ) , open_browser = False ) #NEWLINE# assert_true ( op . isfile ( op . join ( tempdir , 'report2.html' ) ) ) #NEWLINE# report . save ( fname = op . join ( tempdir , 'report.html' ) , open_browser = False , overwrite = True ) #NEWLINE# assert_true ( op . isfile ( op . join ( tempdir , 'report.html' ) ) ) #NEWLINE# pattern = [ '*raw.fif' , '*eve.fif' ] #NEWLINE# with warnings . catch_warnings ( record = True ) as w : #NEWLINE# #INDENT# warnings . simplefilter ( 'always' ) #NEWLINE# report . parse_folder ( data_path = tempdir , pattern = pattern ) #NEWLINE# #UNINDENT# assert_true ( ( len ( w ) >= 1 ) ) #NEWLINE# fnames = ( glob . glob ( op . join ( tempdir , '*.raw' ) ) + glob . glob ( op . join ( tempdir , '*.raw' ) ) ) #NEWLINE# for fname in fnames : #NEWLINE# #INDENT# assert_true ( ( op . basename ( fname ) in [ op . basename ( x ) for x in report . fnames ] ) ) #NEWLINE# assert_true ( ( '' . join ( report . html ) . find ( op . basename ( fname ) ) != ( - 1 ) ) )