From 3216f1f655fab9ad66b5507c8ea2578bf32a564c Mon Sep 17 00:00:00 2001
From: Pierre Raybaut
Date: Fri, 26 Jan 2024 17:54:12 +0100
Subject: [PATCH] Array editor interactive test: added variable_size support
---
guidata/tests/widgets/test_arrayeditor.py | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/guidata/tests/widgets/test_arrayeditor.py b/guidata/tests/widgets/test_arrayeditor.py
index 22ec1a4..7094742 100644
--- a/guidata/tests/widgets/test_arrayeditor.py
+++ b/guidata/tests/widgets/test_arrayeditor.py
@@ -17,10 +17,12 @@
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()
@@ -28,6 +30,16 @@ def launch_arrayeditor(data, title="", xlabels=None, ylabels=None):
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(["ñññéáíó"])),