88
99from __future__ import annotations
1010
11+ import warnings
12+
1113import numpy as np
1214import pytest
1315from guidata .qthelpers import qt_app_context
@@ -28,15 +30,18 @@ def __read_objs(fname: str) -> list[ImageObj] | list[SignalObj]:
2830 for obj in objs :
2931 if np .all (np .isnan (obj .data )):
3032 raise ValueError ("Data is all NaNs" )
33+ for obj in objs :
34+ # Ignore warnings for complex numbers (workaround for guidata)
35+ with np .errstate (all = "ignore" ), warnings .catch_warnings ():
36+ warnings .simplefilter ("ignore" , category = RuntimeWarning )
37+ execenv .print (obj )
3138 return objs
3239
3340
3441@helpers .try_open_test_data ("Testing TXT file reader" , "*.txt" )
3542def open_txt (fname : str | None = None ) -> None :
3643 """Testing TXT files"""
3744 objs = __read_objs (fname )
38- for obj in objs :
39- execenv .print (obj )
4045 if guiutils .is_gui_enabled ():
4146 from sigima_ .tests import vistools # pylint: disable=import-outside-toplevel
4247
@@ -47,8 +52,6 @@ def open_txt(fname: str | None = None) -> None:
4752def open_csv (fname : str | None = None ) -> None :
4853 """Testing CSV files"""
4954 objs = __read_objs (fname )
50- for obj in objs :
51- execenv .print (obj )
5255 if guiutils .is_gui_enabled ():
5356 from sigima_ .tests import vistools # pylint: disable=import-outside-toplevel
5457
@@ -59,8 +62,6 @@ def open_csv(fname: str | None = None) -> None:
5962def open_mat (fname : str | None = None ) -> None :
6063 """Testing MAT files"""
6164 objs = __read_objs (fname )
62- for obj in objs :
63- execenv .print (obj )
6465 if guiutils .is_gui_enabled ():
6566 from sigima_ .tests import vistools # pylint: disable=import-outside-toplevel
6667
0 commit comments