Skip to content

Commit

Permalink
Array editor interactive test: added variable_size support
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRaybaut committed Jan 26, 2024
1 parent db64abc commit 3216f1f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions guidata/tests/widgets/test_arrayeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,29 @@
from guidata.widgets.arrayeditor import ArrayEditor


def launch_arrayeditor(data, title="", xlabels=None, ylabels=None):
def launch_arrayeditor(data, title="", xlabels=None, ylabels=None, variable_size=False):
"""Helper routine to launch an arrayeditor and return its result"""
dlg = ArrayEditor()
dlg.setup_and_check(data, title, xlabels=xlabels, ylabels=ylabels)
dlg.setup_and_check(
data, title, xlabels=xlabels, ylabels=ylabels, variable_size=variable_size
)
exec_dialog(dlg)
return dlg.get_value()


def test_arrayeditor():
"""Test array editor for all supported data types"""
with qt_app_context():
# Variable size version
for title, data in (
("string array", np.array(["kjrekrjkejr"])),
(
"masked array",
np.ma.array([[1, 0], [1, 0]], mask=[[True, False], [False, False]]),
),
("int array", np.array([1, 2, 3], dtype="int8")),
):
launch_arrayeditor(data, "[Variable size] " + title, variable_size=True)
for title, data in (
("string array", np.array(["kjrekrjkejr"])),
("unicode array", np.array(["ñññéáíó"])),
Expand Down

0 comments on commit 3216f1f

Please sign in to comment.