diff --git a/guidata/tests/_all_tests.py b/guidata/tests/_all_tests.py
deleted file mode 100644
index 8cc46da..0000000
--- a/guidata/tests/_all_tests.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# -*- coding: utf-8 -*-
-
-"""
-Run all tests in unattended mode
-"""
-
-import argparse
-import os
-import os.path as osp
-
-import guidata
-from guidata import __version__
-from guidata.guitest import get_tests
-
-
-def run_all_tests(args="", contains="", timeout=None):
- """Run all guidata tests"""
- all_testmodules = get_tests(guidata, "batch")
- testmodules = [
- tmod
- for tmod in all_testmodules
- if not osp.samefile(tmod.path, __file__) and contains in tmod.path
- ]
- tnb = len(testmodules)
- print("*** guidata automatic unit tests ***")
- print("")
- print("Test parameters:")
- print(f" Selected {tnb} tests ({len(all_testmodules) - 1} total available)")
- print(" Environment:")
- for vname in ("PYTHONPATH", "DEBUG"):
- print(f" {vname}={os.environ.get(vname, '')}")
- print("")
- print("Please wait while test scripts are executed (a few minutes).")
- print("Only error messages will be printed out (no message = test OK).")
- print("")
- for idx, testmodule in enumerate(testmodules):
- rpath = osp.relpath(testmodule.path, osp.dirname(guidata.__file__))
- print(f"===[{(idx+1):02d}/{tnb:02d}]=== 🍺 Running test [{rpath}]")
- testmodule.run(args=args, timeout=timeout)
-
-
-def run():
- """Parse arguments and run tests"""
- parser = argparse.ArgumentParser(description="Run all test in unattended mode")
- parser.add_argument("--contains", default="")
- parser.add_argument("--timeout", type=int, default=240)
- args = parser.parse_args()
- run_all_tests("--mode unattended --verbose quiet", args.contains, args.timeout)
-
-
-if __name__ == "__main__":
- run()
diff --git a/guidata/tests/dataset/__init__.py b/guidata/tests/dataset/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/guidata/tests/test_activable_dataset.py b/guidata/tests/dataset/test_activable_dataset.py
similarity index 96%
rename from guidata/tests/test_activable_dataset.py
rename to guidata/tests/dataset/test_activable_dataset.py
index 96612c2..0997115 100644
--- a/guidata/tests/test_activable_dataset.py
+++ b/guidata/tests/dataset/test_activable_dataset.py
@@ -1,60 +1,60 @@
-# -*- coding: utf-8 -*-
-#
-# Licensed under the terms of the BSD 3-Clause
-# (see guidata/LICENSE for details)
-
-"""
-ActivableDataSet example
-
-Warning: ActivableDataSet objects were made to be integrated inside GUI layouts.
-So this example with dialog boxes may be confusing.
---> see tests/editgroupbox.py to understand the activable dataset usage
-"""
-
-# When editing, all items are shown.
-# When showing dataset in read-only mode (e.g. inside another layout), all items
-# are shown except the enable item.
-
-import guidata.dataset as gds
-from guidata.env import execenv
-from guidata.qthelpers import qt_app_context
-
-# guitest: show
-
-
-class Parameters(gds.ActivableDataSet):
- """
- Example
- Activable dataset example
- """
-
- def __init__(self, title=None, comment=None, icon=""):
- gds.ActivableDataSet.__init__(self, title, comment, icon)
-
- enable = gds.BoolItem(
- "Enable parameter set",
- help="If disabled, the following parameters will be ignored",
- default=False,
- )
- param0 = gds.ChoiceItem("Param 0", ["choice #1", "choice #2", "choice #3"])
- param1 = gds.FloatItem("Param 1", default=0, min=0)
- param2 = gds.FloatItem("Param 2", default=0.93)
- color = gds.ColorItem("Color", default="red")
-
-
-Parameters.active_setup()
-
-
-def test_activable_dataset():
- """Test activable dataset"""
- with qt_app_context():
- prm = Parameters()
- prm.set_writeable()
- prm.edit()
- prm.set_readonly()
- prm.view()
- execenv.print("OK")
-
-
-if __name__ == "__main__":
- test_activable_dataset()
+# -*- coding: utf-8 -*-
+#
+# Licensed under the terms of the BSD 3-Clause
+# (see guidata/LICENSE for details)
+
+"""
+ActivableDataSet example
+
+Warning: ActivableDataSet objects were made to be integrated inside GUI layouts.
+So this example with dialog boxes may be confusing.
+--> see tests/editgroupbox.py to understand the activable dataset usage
+"""
+
+# When editing, all items are shown.
+# When showing dataset in read-only mode (e.g. inside another layout), all items
+# are shown except the enable item.
+
+import guidata.dataset as gds
+from guidata.env import execenv
+from guidata.qthelpers import qt_app_context
+
+# guitest: show
+
+
+class Parameters(gds.ActivableDataSet):
+ """
+ Example
+ Activable dataset example
+ """
+
+ def __init__(self, title=None, comment=None, icon=""):
+ gds.ActivableDataSet.__init__(self, title, comment, icon)
+
+ enable = gds.BoolItem(
+ "Enable parameter set",
+ help="If disabled, the following parameters will be ignored",
+ default=False,
+ )
+ param0 = gds.ChoiceItem("Param 0", ["choice #1", "choice #2", "choice #3"])
+ param1 = gds.FloatItem("Param 1", default=0, min=0)
+ param2 = gds.FloatItem("Param 2", default=0.93)
+ color = gds.ColorItem("Color", default="red")
+
+
+Parameters.active_setup()
+
+
+def test_activable_dataset():
+ """Test activable dataset"""
+ with qt_app_context():
+ prm = Parameters()
+ prm.set_writeable()
+ prm.edit()
+ prm.set_readonly()
+ prm.view()
+ execenv.print("OK")
+
+
+if __name__ == "__main__":
+ test_activable_dataset()
diff --git a/guidata/tests/test_activable_items.py b/guidata/tests/dataset/test_activable_items.py
similarity index 96%
rename from guidata/tests/test_activable_items.py
rename to guidata/tests/dataset/test_activable_items.py
index e6b27a2..7f70bfd 100644
--- a/guidata/tests/test_activable_items.py
+++ b/guidata/tests/dataset/test_activable_items.py
@@ -1,39 +1,39 @@
-# -*- coding: utf-8 -*-
-#
-# Licensed under the terms of the BSD 3-Clause
-# (see guidata/LICENSE for details)
-
-"""
-Example with activable items: items which active state is changed depending
-on another item's value.
-"""
-
-# guitest: show
-
-from guidata.dataset import ChoiceItem, DataSet, FloatItem, FuncProp, GetAttrProp
-from guidata.env import execenv
-from guidata.qthelpers import qt_app_context
-
-choices = (("A", "Choice #1: A"), ("B", "Choice #2: B"), ("C", "Choice #3: C"))
-
-
-class Parameters(DataSet):
- """Example dataset"""
-
- _prop = GetAttrProp("choice")
- choice = ChoiceItem("Choice", choices).set_prop("display", store=_prop)
- x1 = FloatItem("x1")
- x2 = FloatItem("x2").set_prop("display", active=FuncProp(_prop, lambda x: x == "B"))
- x3 = FloatItem("x3").set_prop("display", active=FuncProp(_prop, lambda x: x == "C"))
-
-
-def test_activable_items():
- """Test activable items"""
- with qt_app_context():
- test = Parameters()
- test.edit()
- execenv.print("OK")
-
-
-if __name__ == "__main__":
- test_activable_items()
+# -*- coding: utf-8 -*-
+#
+# Licensed under the terms of the BSD 3-Clause
+# (see guidata/LICENSE for details)
+
+"""
+Example with activable items: items which active state is changed depending
+on another item's value.
+"""
+
+# guitest: show
+
+from guidata.dataset import ChoiceItem, DataSet, FloatItem, FuncProp, GetAttrProp
+from guidata.env import execenv
+from guidata.qthelpers import qt_app_context
+
+choices = (("A", "Choice #1: A"), ("B", "Choice #2: B"), ("C", "Choice #3: C"))
+
+
+class Parameters(DataSet):
+ """Example dataset"""
+
+ _prop = GetAttrProp("choice")
+ choice = ChoiceItem("Choice", choices).set_prop("display", store=_prop)
+ x1 = FloatItem("x1")
+ x2 = FloatItem("x2").set_prop("display", active=FuncProp(_prop, lambda x: x == "B"))
+ x3 = FloatItem("x3").set_prop("display", active=FuncProp(_prop, lambda x: x == "C"))
+
+
+def test_activable_items():
+ """Test activable items"""
+ with qt_app_context():
+ test = Parameters()
+ test.edit()
+ execenv.print("OK")
+
+
+if __name__ == "__main__":
+ test_activable_items()
diff --git a/guidata/tests/test_all_features.py b/guidata/tests/dataset/test_all_features.py
similarity index 96%
rename from guidata/tests/test_all_features.py
rename to guidata/tests/dataset/test_all_features.py
index f6ede8f..117c2ed 100644
--- a/guidata/tests/test_all_features.py
+++ b/guidata/tests/dataset/test_all_features.py
@@ -1,142 +1,142 @@
-# -*- coding: utf-8 -*-
-#
-# Licensed under the terms of the BSD 3-Clause
-# (see guidata/LICENSE for details)
-
-"""
-All guidata item/group features demo
-"""
-
-# guitest: show
-
-import atexit
-import shutil
-import tempfile
-
-import numpy as np
-
-import guidata.dataset as gds
-from guidata.dataset.qtitemwidgets import DataSetWidget
-from guidata.dataset.qtwidgets import DataSetEditLayout, DataSetShowLayout
-from guidata.env import execenv
-from guidata.qthelpers import qt_app_context
-
-# Creating temporary files and registering cleanup functions
-TEMPDIR = tempfile.mkdtemp(prefix="test_")
-atexit.register(shutil.rmtree, TEMPDIR)
-FILE_ETA = tempfile.NamedTemporaryFile(suffix=".eta", dir=TEMPDIR)
-atexit.register(FILE_ETA.close)
-FILE_CSV = tempfile.NamedTemporaryFile(suffix=".csv", dir=TEMPDIR)
-atexit.register(FILE_CSV.close)
-
-
-class SubDataSet(gds.DataSet):
- dir = gds.DirectoryItem("Directory", TEMPDIR)
- fname = gds.FileOpenItem("Single file (open)", ("csv", "eta"), FILE_CSV.name)
- fnames = gds.FilesOpenItem("Multiple files", "csv", FILE_CSV.name)
- fname_s = gds.FileSaveItem("Single file (save)", "eta", FILE_ETA.name)
-
-
-class SubDataSetWidget(DataSetWidget):
- klass = SubDataSet
-
-
-class SubDataSetItem(gds.ObjectItem):
- klass = SubDataSet
-
-
-DataSetEditLayout.register(SubDataSetItem, SubDataSetWidget)
-DataSetShowLayout.register(SubDataSetItem, SubDataSetWidget)
-
-
-class Parameters(gds.DataSet):
- """
- DataSet test
- The following text is the DataSet 'comment':
Plain text or
- rich text2 are both supported,
- as well as special characters (α, β, γ, δ, ...)
- """
-
- dict_ = gds.DictItem(
- "dict_item",
- {
- "strings_col": ["a", "b", "c"],
- "_col": [1, 2.0, 3],
- "float_col": 1.0,
- },
- )
- string = gds.StringItem("String")
- string_regexp = gds.StringItem("String", regexp=r"^[a-z]+[0-9]$", default="abcd9")
- password = gds.StringItem("Password", password=True)
- text = gds.TextItem("Text")
- _bg = gds.BeginGroup("A sub group")
- float_slider = gds.FloatItem(
- "Float (with slider)", default=0.5, min=0, max=1, step=0.01, slider=True
- )
- fl1 = gds.FloatItem(
- "Current", default=10.0, min=1, max=30, unit="mA", help="Threshold current"
- )
- fl2 = gds.FloatItem("Float (col=1)", default=1.0, min=1, max=1).set_pos(col=1)
- fl3 = gds.FloatItem("Not checked float").set_prop("data", check_value=False)
- bool1 = gds.BoolItem("Boolean option without label")
- bool2 = gds.BoolItem("Boolean option with label", "Label").set_pos(col=1, colspan=2)
- color = gds.ColorItem("Color", default="red")
- choice1 = gds.ChoiceItem(
- "Single choice (radio)",
- [(16, "first choice"), (32, "second choice"), (64, "third choice")],
- radio=True,
- ).set_pos(col=1, colspan=2)
- choice2 = gds.ChoiceItem(
- "Single choice (combo)",
- [(16, "first choice"), (32, "second choice"), (64, "third choice")],
- ).set_pos(col=1, colspan=2)
- _eg = gds.EndGroup("A sub group")
- floatarray = gds.FloatArrayItem(
- "Float array", default=np.ones((50, 5), float), format=" %.2e "
- ).set_pos(col=1)
- g0 = gds.BeginTabGroup("group")
- mchoice1 = gds.MultipleChoiceItem(
- "MC type 1", ["first choice", "second choice", "third choice"]
- ).vertical(2)
- mchoice2 = (
- gds.ImageChoiceItem(
- "MC type 2",
- [
- ("rect", "first choice", "gif.png"),
- ("ell", "second choice", "txt.png"),
- ("qcq", "third choice", "file.png"),
- ],
- )
- .set_pos(col=1)
- .set_prop("display", icon="file.png")
- )
- mchoice3 = gds.MultipleChoiceItem(
- "MC type 3", [str(i) for i in range(10)]
- ).horizontal(2)
- eg0 = gds.EndTabGroup("group")
- integer_slider = gds.IntItem(
- "Integer (with slider)", default=5, min=-50, max=50, slider=True
- )
- integer = gds.IntItem("Integer", default=5, min=3, max=6).set_pos(col=1)
-
-
-def test_all_features():
- """Test all guidata item/group features"""
- with qt_app_context():
- prm1 = Parameters()
- prm1.floatarray[:, 0] = np.linspace(-5, 5, 50)
- execenv.print(prm1)
-
- if prm1.edit():
- prm1.edit()
- execenv.print(prm1)
- prm1.view()
-
- prm2 = Parameters.create(integer=10101010, string="Using create class method")
- print(prm2)
-
- execenv.print("OK")
-
-
-if __name__ == "__main__":
- test_all_features()
+# -*- coding: utf-8 -*-
+#
+# Licensed under the terms of the BSD 3-Clause
+# (see guidata/LICENSE for details)
+
+"""
+All guidata item/group features demo
+"""
+
+# guitest: show
+
+import atexit
+import shutil
+import tempfile
+
+import numpy as np
+
+import guidata.dataset as gds
+from guidata.dataset.qtitemwidgets import DataSetWidget
+from guidata.dataset.qtwidgets import DataSetEditLayout, DataSetShowLayout
+from guidata.env import execenv
+from guidata.qthelpers import qt_app_context
+
+# Creating temporary files and registering cleanup functions
+TEMPDIR = tempfile.mkdtemp(prefix="test_")
+atexit.register(shutil.rmtree, TEMPDIR)
+FILE_ETA = tempfile.NamedTemporaryFile(suffix=".eta", dir=TEMPDIR)
+atexit.register(FILE_ETA.close)
+FILE_CSV = tempfile.NamedTemporaryFile(suffix=".csv", dir=TEMPDIR)
+atexit.register(FILE_CSV.close)
+
+
+class SubDataSet(gds.DataSet):
+ dir = gds.DirectoryItem("Directory", TEMPDIR)
+ fname = gds.FileOpenItem("Single file (open)", ("csv", "eta"), FILE_CSV.name)
+ fnames = gds.FilesOpenItem("Multiple files", "csv", FILE_CSV.name)
+ fname_s = gds.FileSaveItem("Single file (save)", "eta", FILE_ETA.name)
+
+
+class SubDataSetWidget(DataSetWidget):
+ klass = SubDataSet
+
+
+class SubDataSetItem(gds.ObjectItem):
+ klass = SubDataSet
+
+
+DataSetEditLayout.register(SubDataSetItem, SubDataSetWidget)
+DataSetShowLayout.register(SubDataSetItem, SubDataSetWidget)
+
+
+class Parameters(gds.DataSet):
+ """
+ DataSet test
+ The following text is the DataSet 'comment':
Plain text or
+ rich text2 are both supported,
+ as well as special characters (α, β, γ, δ, ...)
+ """
+
+ dict_ = gds.DictItem(
+ "dict_item",
+ {
+ "strings_col": ["a", "b", "c"],
+ "_col": [1, 2.0, 3],
+ "float_col": 1.0,
+ },
+ )
+ string = gds.StringItem("String")
+ string_regexp = gds.StringItem("String", regexp=r"^[a-z]+[0-9]$", default="abcd9")
+ password = gds.StringItem("Password", password=True)
+ text = gds.TextItem("Text")
+ _bg = gds.BeginGroup("A sub group")
+ float_slider = gds.FloatItem(
+ "Float (with slider)", default=0.5, min=0, max=1, step=0.01, slider=True
+ )
+ fl1 = gds.FloatItem(
+ "Current", default=10.0, min=1, max=30, unit="mA", help="Threshold current"
+ )
+ fl2 = gds.FloatItem("Float (col=1)", default=1.0, min=1, max=1).set_pos(col=1)
+ fl3 = gds.FloatItem("Not checked float").set_prop("data", check_value=False)
+ bool1 = gds.BoolItem("Boolean option without label")
+ bool2 = gds.BoolItem("Boolean option with label", "Label").set_pos(col=1, colspan=2)
+ color = gds.ColorItem("Color", default="red")
+ choice1 = gds.ChoiceItem(
+ "Single choice (radio)",
+ [(16, "first choice"), (32, "second choice"), (64, "third choice")],
+ radio=True,
+ ).set_pos(col=1, colspan=2)
+ choice2 = gds.ChoiceItem(
+ "Single choice (combo)",
+ [(16, "first choice"), (32, "second choice"), (64, "third choice")],
+ ).set_pos(col=1, colspan=2)
+ _eg = gds.EndGroup("A sub group")
+ floatarray = gds.FloatArrayItem(
+ "Float array", default=np.ones((50, 5), float), format=" %.2e "
+ ).set_pos(col=1)
+ g0 = gds.BeginTabGroup("group")
+ mchoice1 = gds.MultipleChoiceItem(
+ "MC type 1", ["first choice", "second choice", "third choice"]
+ ).vertical(2)
+ mchoice2 = (
+ gds.ImageChoiceItem(
+ "MC type 2",
+ [
+ ("rect", "first choice", "gif.png"),
+ ("ell", "second choice", "txt.png"),
+ ("qcq", "third choice", "file.png"),
+ ],
+ )
+ .set_pos(col=1)
+ .set_prop("display", icon="file.png")
+ )
+ mchoice3 = gds.MultipleChoiceItem(
+ "MC type 3", [str(i) for i in range(10)]
+ ).horizontal(2)
+ eg0 = gds.EndTabGroup("group")
+ integer_slider = gds.IntItem(
+ "Integer (with slider)", default=5, min=-50, max=50, slider=True
+ )
+ integer = gds.IntItem("Integer", default=5, min=3, max=6).set_pos(col=1)
+
+
+def test_all_features():
+ """Test all guidata item/group features"""
+ with qt_app_context():
+ prm1 = Parameters()
+ prm1.floatarray[:, 0] = np.linspace(-5, 5, 50)
+ execenv.print(prm1)
+
+ if prm1.edit():
+ prm1.edit()
+ execenv.print(prm1)
+ prm1.view()
+
+ prm2 = Parameters.create(integer=10101010, string="Using create class method")
+ print(prm2)
+
+ execenv.print("OK")
+
+
+if __name__ == "__main__":
+ test_all_features()
diff --git a/guidata/tests/test_all_items.py b/guidata/tests/dataset/test_all_items.py
similarity index 96%
rename from guidata/tests/test_all_items.py
rename to guidata/tests/dataset/test_all_items.py
index 56d1474..c0094a5 100644
--- a/guidata/tests/test_all_items.py
+++ b/guidata/tests/dataset/test_all_items.py
@@ -1,118 +1,118 @@
-# -*- coding: utf-8 -*-
-#
-# Licensed under the terms of the BSD 3-Clause
-# (see guidata/LICENSE for details)
-
-"""
-All guidata DataItem objects demo
-
-A DataSet object is a set of parameters of various types (integer, float,
-boolean, string, etc.) which may be edited in a dialog box thanks to the
-'edit' method. Parameters are defined by assigning DataItem objects to a
-DataSet class definition: each parameter type has its own DataItem class
-(IntItem for integers, FloatItem for floats, StringItem for strings, etc.)
-"""
-
-# guitest: show
-
-import atexit
-import datetime
-import shutil
-import tempfile
-
-import numpy as np
-
-import guidata.dataset as gds
-from guidata.env import execenv
-from guidata.qthelpers import qt_app_context
-
-# Creating temporary files and registering cleanup functions
-TEMPDIR = tempfile.mkdtemp(prefix="test_")
-atexit.register(shutil.rmtree, TEMPDIR)
-FILE_ETA = tempfile.NamedTemporaryFile(suffix=".eta", dir=TEMPDIR)
-atexit.register(FILE_ETA.close)
-FILE_CSV = tempfile.NamedTemporaryFile(suffix=".csv", dir=TEMPDIR)
-atexit.register(FILE_CSV.close)
-
-
-class Parameters(gds.DataSet):
- """
- DataSet test
- The following text is the DataSet 'comment':
Plain text or
- rich text2 are both supported,
- as well as special characters (α, β, γ, δ, ...)
- """
-
- dir = gds.DirectoryItem("Directory", TEMPDIR)
- fname = gds.FileOpenItem("Open file", ("csv", "eta"), FILE_CSV.name)
- fnames = gds.FilesOpenItem("Open files", "csv", FILE_CSV.name)
- fname_s = gds.FileSaveItem("Save file", "eta", FILE_ETA.name)
- string = gds.StringItem("String")
- text = gds.TextItem("Text")
- float_slider = gds.FloatItem(
- "Float (with slider)", default=0.5, min=0, max=1, step=0.01, slider=True
- )
- integer = gds.IntItem("Integer", default=5, min=3, max=16, slider=True).set_pos(
- col=1
- )
- dtime = gds.DateTimeItem("Date/time", default=datetime.datetime(2010, 10, 10))
- date = gds.DateItem("Date", default=datetime.date(2010, 10, 10)).set_pos(col=1)
- bool1 = gds.BoolItem("Boolean option without label")
- bool2 = gds.BoolItem("Boolean option with label", "Label")
- _bg = gds.BeginGroup("A sub group")
- color = gds.ColorItem("Color", default="red")
- choice = gds.ChoiceItem(
- "Single choice 1",
- [("16", "first choice"), ("32", "second choice"), ("64", "third choice")],
- )
- mchoice2 = gds.ImageChoiceItem(
- "Single choice 2",
- [
- ("rect", "first choice", "gif.png"),
- ("ell", "second choice", "txt.png"),
- ("qcq", "third choice", "file.png"),
- ],
- )
- _eg = gds.EndGroup("A sub group")
- floatarray = gds.FloatArrayItem(
- "Float array", default=np.ones((50, 5), float), format=" %.2e "
- ).set_pos(col=1)
- mchoice3 = gds.MultipleChoiceItem(
- "MC type 1", [str(i) for i in range(12)]
- ).horizontal(4)
- mchoice1 = (
- gds.MultipleChoiceItem(
- "MC type 2", ["first choice", "second choice", "third choice"]
- )
- .vertical(1)
- .set_pos(col=1)
- )
- dictionary = gds.DictItem(
- "Dictionary",
- default={
- "lkl": 2,
- "tototo": 3,
- "zzzz": "lklk",
- "bool": True,
- "float": 1.234,
- "list": [1, 2.5, 3, "str", False, 5, {"lkl": 2, "l": [1, 2, 3]}],
- },
- help="This is a dictionary",
- )
-
-
-def test_all_items():
- """Test all DataItem objects"""
- with qt_app_context():
- prm = Parameters()
-
- prm.floatarray[:, 0] = np.linspace(-5, 5, 50)
- execenv.print(prm)
- if prm.edit():
- execenv.print(prm)
- prm.view()
- execenv.print("OK")
-
-
-if __name__ == "__main__":
- test_all_items()
+# -*- coding: utf-8 -*-
+#
+# Licensed under the terms of the BSD 3-Clause
+# (see guidata/LICENSE for details)
+
+"""
+All guidata DataItem objects demo
+
+A DataSet object is a set of parameters of various types (integer, float,
+boolean, string, etc.) which may be edited in a dialog box thanks to the
+'edit' method. Parameters are defined by assigning DataItem objects to a
+DataSet class definition: each parameter type has its own DataItem class
+(IntItem for integers, FloatItem for floats, StringItem for strings, etc.)
+"""
+
+# guitest: show
+
+import atexit
+import datetime
+import shutil
+import tempfile
+
+import numpy as np
+
+import guidata.dataset as gds
+from guidata.env import execenv
+from guidata.qthelpers import qt_app_context
+
+# Creating temporary files and registering cleanup functions
+TEMPDIR = tempfile.mkdtemp(prefix="test_")
+atexit.register(shutil.rmtree, TEMPDIR)
+FILE_ETA = tempfile.NamedTemporaryFile(suffix=".eta", dir=TEMPDIR)
+atexit.register(FILE_ETA.close)
+FILE_CSV = tempfile.NamedTemporaryFile(suffix=".csv", dir=TEMPDIR)
+atexit.register(FILE_CSV.close)
+
+
+class Parameters(gds.DataSet):
+ """
+ DataSet test
+ The following text is the DataSet 'comment':
Plain text or
+ rich text2 are both supported,
+ as well as special characters (α, β, γ, δ, ...)
+ """
+
+ dir = gds.DirectoryItem("Directory", TEMPDIR)
+ fname = gds.FileOpenItem("Open file", ("csv", "eta"), FILE_CSV.name)
+ fnames = gds.FilesOpenItem("Open files", "csv", FILE_CSV.name)
+ fname_s = gds.FileSaveItem("Save file", "eta", FILE_ETA.name)
+ string = gds.StringItem("String")
+ text = gds.TextItem("Text")
+ float_slider = gds.FloatItem(
+ "Float (with slider)", default=0.5, min=0, max=1, step=0.01, slider=True
+ )
+ integer = gds.IntItem("Integer", default=5, min=3, max=16, slider=True).set_pos(
+ col=1
+ )
+ dtime = gds.DateTimeItem("Date/time", default=datetime.datetime(2010, 10, 10))
+ date = gds.DateItem("Date", default=datetime.date(2010, 10, 10)).set_pos(col=1)
+ bool1 = gds.BoolItem("Boolean option without label")
+ bool2 = gds.BoolItem("Boolean option with label", "Label")
+ _bg = gds.BeginGroup("A sub group")
+ color = gds.ColorItem("Color", default="red")
+ choice = gds.ChoiceItem(
+ "Single choice 1",
+ [("16", "first choice"), ("32", "second choice"), ("64", "third choice")],
+ )
+ mchoice2 = gds.ImageChoiceItem(
+ "Single choice 2",
+ [
+ ("rect", "first choice", "gif.png"),
+ ("ell", "second choice", "txt.png"),
+ ("qcq", "third choice", "file.png"),
+ ],
+ )
+ _eg = gds.EndGroup("A sub group")
+ floatarray = gds.FloatArrayItem(
+ "Float array", default=np.ones((50, 5), float), format=" %.2e "
+ ).set_pos(col=1)
+ mchoice3 = gds.MultipleChoiceItem(
+ "MC type 1", [str(i) for i in range(12)]
+ ).horizontal(4)
+ mchoice1 = (
+ gds.MultipleChoiceItem(
+ "MC type 2", ["first choice", "second choice", "third choice"]
+ )
+ .vertical(1)
+ .set_pos(col=1)
+ )
+ dictionary = gds.DictItem(
+ "Dictionary",
+ default={
+ "lkl": 2,
+ "tototo": 3,
+ "zzzz": "lklk",
+ "bool": True,
+ "float": 1.234,
+ "list": [1, 2.5, 3, "str", False, 5, {"lkl": 2, "l": [1, 2, 3]}],
+ },
+ help="This is a dictionary",
+ )
+
+
+def test_all_items():
+ """Test all DataItem objects"""
+ with qt_app_context():
+ prm = Parameters()
+
+ prm.floatarray[:, 0] = np.linspace(-5, 5, 50)
+ execenv.print(prm)
+ if prm.edit():
+ execenv.print(prm)
+ prm.view()
+ execenv.print("OK")
+
+
+if __name__ == "__main__":
+ test_all_items()
diff --git a/guidata/tests/test_bool_selector.py b/guidata/tests/dataset/test_bool_selector.py
similarity index 96%
rename from guidata/tests/test_bool_selector.py
rename to guidata/tests/dataset/test_bool_selector.py
index e0c7b13..6e8e582 100644
--- a/guidata/tests/test_bool_selector.py
+++ b/guidata/tests/dataset/test_bool_selector.py
@@ -1,60 +1,60 @@
-# -*- coding: utf-8 -*-
-#
-# Licensed under the terms of the BSD 3-Clause
-# (see guidata/LICENSE for details)
-
-"""
-DataItem groups and group selection
-
-DataSet items may be included in groups (these items are then shown in group
-box widgets in the editing dialog box) and item groups may be enabled/disabled
-using one group parameter (a boolean item).
-"""
-
-# guitest: show
-
-import guidata.dataset as gds
-from guidata.env import execenv
-from guidata.qthelpers import qt_app_context
-
-prop1 = gds.ValueProp(False)
-prop2 = gds.ValueProp(False)
-
-
-class Parameters(gds.DataSet):
- """
- Group selection test
- Group selection example:
- """
-
- g1 = gds.BeginGroup("group 1")
- enable1 = gds.BoolItem(
- "Enable parameter set #1",
- help="If disabled, the following parameters will be ignored",
- default=False,
- ).set_prop("display", store=prop1)
- prm11 = gds.FloatItem("Prm 1.1", default=0, min=0).set_prop("display", active=prop1)
- prm12 = gds.FloatItem("Prm 1.2", default=0.93).set_prop("display", active=prop1)
- _g1 = gds.EndGroup("group 1")
- g2 = gds.BeginGroup("group 2")
- enable2 = gds.BoolItem(
- "Enable parameter set #2",
- help="If disabled, the following parameters will be ignored",
- default=True,
- ).set_prop("display", store=prop2)
- prm21 = gds.FloatItem("Prm 2.1", default=0, min=0).set_prop("display", active=prop2)
- prm22 = gds.FloatItem("Prm 2.2", default=0.93).set_prop("display", active=prop2)
- _g2 = gds.EndGroup("group 2")
-
-
-def test_bool_selector():
- """Test bool selector"""
- with qt_app_context():
- prm = Parameters()
- prm.edit()
- execenv.print(prm)
- execenv.print("OK")
-
-
-if __name__ == "__main__":
- test_bool_selector()
+# -*- coding: utf-8 -*-
+#
+# Licensed under the terms of the BSD 3-Clause
+# (see guidata/LICENSE for details)
+
+"""
+DataItem groups and group selection
+
+DataSet items may be included in groups (these items are then shown in group
+box widgets in the editing dialog box) and item groups may be enabled/disabled
+using one group parameter (a boolean item).
+"""
+
+# guitest: show
+
+import guidata.dataset as gds
+from guidata.env import execenv
+from guidata.qthelpers import qt_app_context
+
+prop1 = gds.ValueProp(False)
+prop2 = gds.ValueProp(False)
+
+
+class Parameters(gds.DataSet):
+ """
+ Group selection test
+ Group selection example:
+ """
+
+ g1 = gds.BeginGroup("group 1")
+ enable1 = gds.BoolItem(
+ "Enable parameter set #1",
+ help="If disabled, the following parameters will be ignored",
+ default=False,
+ ).set_prop("display", store=prop1)
+ prm11 = gds.FloatItem("Prm 1.1", default=0, min=0).set_prop("display", active=prop1)
+ prm12 = gds.FloatItem("Prm 1.2", default=0.93).set_prop("display", active=prop1)
+ _g1 = gds.EndGroup("group 1")
+ g2 = gds.BeginGroup("group 2")
+ enable2 = gds.BoolItem(
+ "Enable parameter set #2",
+ help="If disabled, the following parameters will be ignored",
+ default=True,
+ ).set_prop("display", store=prop2)
+ prm21 = gds.FloatItem("Prm 2.1", default=0, min=0).set_prop("display", active=prop2)
+ prm22 = gds.FloatItem("Prm 2.2", default=0.93).set_prop("display", active=prop2)
+ _g2 = gds.EndGroup("group 2")
+
+
+def test_bool_selector():
+ """Test bool selector"""
+ with qt_app_context():
+ prm = Parameters()
+ prm.edit()
+ execenv.print(prm)
+ execenv.print("OK")
+
+
+if __name__ == "__main__":
+ test_bool_selector()
diff --git a/guidata/tests/test_callbacks.py b/guidata/tests/dataset/test_callbacks.py
similarity index 96%
rename from guidata/tests/test_callbacks.py
rename to guidata/tests/dataset/test_callbacks.py
index 334020a..48c638a 100644
--- a/guidata/tests/test_callbacks.py
+++ b/guidata/tests/dataset/test_callbacks.py
@@ -1,84 +1,84 @@
-# -*- coding: utf-8 -*-
-#
-# Licensed under the terms of the BSD 3-Clause
-# (see guidata/LICENSE for details)
-
-"""
-Demonstrates how items may trigger callbacks when activated, or how
-the list of choices may be dynamically changed.
-"""
-
-# guitest: show
-
-import guidata.dataset as gds
-from guidata.env import execenv
-from guidata.qthelpers import qt_app_context
-
-
-class Parameters(gds.DataSet):
- """Example dataset"""
-
- def cb_example(self, item, value):
- execenv.print("\nitem: ", item, "\nvalue:", value)
- if self.results is None:
- self.results = ""
- self.results += str(value) + "\n"
- execenv.print("results:", self.results)
-
- def update_x1plusx2(self, item, value):
- execenv.print("\nitem: ", item, "\nvalue:", value)
- if self.x1 is not None and self.x2 is not None:
- self.x1plusx2 = self.x1 + self.x2
- else:
- self.x1plusx2 = None
-
- string = gds.StringItem("String", default="foobar").set_prop(
- "display", callback=cb_example
- )
- x1 = gds.FloatItem("x1").set_prop("display", callback=update_x1plusx2)
- x2 = gds.FloatItem("x2").set_prop("display", callback=update_x1plusx2)
- x1plusx2 = gds.FloatItem("x1+x2").set_prop("display", active=False)
- color = gds.ColorItem("Color", default="red").set_prop(
- "display", callback=cb_example
- )
-
- def choices_callback(self, item, value):
- """Choices callback: this demonstrates how to dynamically change
- the list of choices... even if it is not very useful in this case
-
- Note that `None` is systematically added as the third element of
- the returned tuples: that is to ensure the compatibility between
- `ChoiceItem` and `ImageChoiceItem` (see `guidata.dataset.dataitems`)
- """
- execenv.print(f"[choices_callback]: item={item}, value={value}")
- return [
- (16, "first choice", None),
- (32, "second choice", None),
- (64, "third choice", None),
- ]
-
- choice = (
- gds.ChoiceItem(
- "Single choice",
- choices_callback,
- default=64,
- )
- .set_pos(col=1, colspan=2)
- .set_prop("display", callback=cb_example)
- )
- results = gds.TextItem("Results")
-
-
-def test_callbacks():
- """Test callbacks"""
- with qt_app_context():
- prm = Parameters()
- execenv.print(prm)
- if prm.edit():
- execenv.print(prm)
- prm.view()
- execenv.print("OK")
-
-
-if __name__ == "__main__":
- test_callbacks()
+# -*- coding: utf-8 -*-
+#
+# Licensed under the terms of the BSD 3-Clause
+# (see guidata/LICENSE for details)
+
+"""
+Demonstrates how items may trigger callbacks when activated, or how
+the list of choices may be dynamically changed.
+"""
+
+# guitest: show
+
+import guidata.dataset as gds
+from guidata.env import execenv
+from guidata.qthelpers import qt_app_context
+
+
+class Parameters(gds.DataSet):
+ """Example dataset"""
+
+ def cb_example(self, item, value):
+ execenv.print("\nitem: ", item, "\nvalue:", value)
+ if self.results is None:
+ self.results = ""
+ self.results += str(value) + "\n"
+ execenv.print("results:", self.results)
+
+ def update_x1plusx2(self, item, value):
+ execenv.print("\nitem: ", item, "\nvalue:", value)
+ if self.x1 is not None and self.x2 is not None:
+ self.x1plusx2 = self.x1 + self.x2
+ else:
+ self.x1plusx2 = None
+
+ string = gds.StringItem("String", default="foobar").set_prop(
+ "display", callback=cb_example
+ )
+ x1 = gds.FloatItem("x1").set_prop("display", callback=update_x1plusx2)
+ x2 = gds.FloatItem("x2").set_prop("display", callback=update_x1plusx2)
+ x1plusx2 = gds.FloatItem("x1+x2").set_prop("display", active=False)
+ color = gds.ColorItem("Color", default="red").set_prop(
+ "display", callback=cb_example
+ )
+
+ def choices_callback(self, item, value):
+ """Choices callback: this demonstrates how to dynamically change
+ the list of choices... even if it is not very useful in this case
+
+ Note that `None` is systematically added as the third element of
+ the returned tuples: that is to ensure the compatibility between
+ `ChoiceItem` and `ImageChoiceItem` (see `guidata.dataset.dataitems`)
+ """
+ execenv.print(f"[choices_callback]: item={item}, value={value}")
+ return [
+ (16, "first choice", None),
+ (32, "second choice", None),
+ (64, "third choice", None),
+ ]
+
+ choice = (
+ gds.ChoiceItem(
+ "Single choice",
+ choices_callback,
+ default=64,
+ )
+ .set_pos(col=1, colspan=2)
+ .set_prop("display", callback=cb_example)
+ )
+ results = gds.TextItem("Results")
+
+
+def test_callbacks():
+ """Test callbacks"""
+ with qt_app_context():
+ prm = Parameters()
+ execenv.print(prm)
+ if prm.edit():
+ execenv.print(prm)
+ prm.view()
+ execenv.print("OK")
+
+
+if __name__ == "__main__":
+ test_callbacks()
diff --git a/guidata/tests/test_datasetgroup.py b/guidata/tests/dataset/test_datasetgroup.py
similarity index 89%
rename from guidata/tests/test_datasetgroup.py
rename to guidata/tests/dataset/test_datasetgroup.py
index 53d715d..2a1f317 100644
--- a/guidata/tests/test_datasetgroup.py
+++ b/guidata/tests/dataset/test_datasetgroup.py
@@ -1,34 +1,34 @@
-# -*- coding: utf-8 -*-
-#
-# Licensed under the terms of the BSD 3-Clause
-# (see guidata/LICENSE for details)
-
-"""
-DataSetGroup demo
-
-DataSet objects may be grouped into DataSetGroup, allowing them to be edited
-in a single dialog box (with one tab per DataSet object).
-"""
-
-# guitest: show
-
-from guidata.dataset import DataSetGroup
-from guidata.env import execenv
-from guidata.qthelpers import qt_app_context
-from guidata.tests.test_all_features import Parameters
-
-
-def test_dataset_group():
- """Test DataSetGroup"""
- with qt_app_context():
- e1 = Parameters("DataSet #1")
- e2 = Parameters("DataSet #2")
- g = DataSetGroup([e1, e2], title="Parameters group")
- g.edit()
- execenv.print(e1)
- g.edit()
- execenv.print("OK")
-
-
-if __name__ == "__main__":
- test_dataset_group()
+# -*- coding: utf-8 -*-
+#
+# Licensed under the terms of the BSD 3-Clause
+# (see guidata/LICENSE for details)
+
+"""
+DataSetGroup demo
+
+DataSet objects may be grouped into DataSetGroup, allowing them to be edited
+in a single dialog box (with one tab per DataSet object).
+"""
+
+# guitest: show
+
+from guidata.dataset import DataSetGroup
+from guidata.env import execenv
+from guidata.qthelpers import qt_app_context
+from guidata.tests.dataset.test_all_features import Parameters
+
+
+def test_dataset_group():
+ """Test DataSetGroup"""
+ with qt_app_context():
+ e1 = Parameters("DataSet #1")
+ e2 = Parameters("DataSet #2")
+ g = DataSetGroup([e1, e2], title="Parameters group")
+ g.edit()
+ execenv.print(e1)
+ g.edit()
+ execenv.print("OK")
+
+
+if __name__ == "__main__":
+ test_dataset_group()
diff --git a/guidata/tests/test_editgroupbox.py b/guidata/tests/dataset/test_editgroupbox.py
similarity index 98%
rename from guidata/tests/test_editgroupbox.py
rename to guidata/tests/dataset/test_editgroupbox.py
index 6c63941..afc3fd7 100644
--- a/guidata/tests/test_editgroupbox.py
+++ b/guidata/tests/dataset/test_editgroupbox.py
@@ -26,7 +26,7 @@
qt_app_context,
win32_fix_title_bar_background,
)
-from guidata.tests.test_activable_dataset import Parameters
+from guidata.tests.dataset.test_activable_dataset import Parameters
from guidata.widgets import about
diff --git a/guidata/tests/test_inheritance.py b/guidata/tests/dataset/test_inheritance.py
similarity index 96%
rename from guidata/tests/test_inheritance.py
rename to guidata/tests/dataset/test_inheritance.py
index 060949f..3bc38d1 100644
--- a/guidata/tests/test_inheritance.py
+++ b/guidata/tests/dataset/test_inheritance.py
@@ -1,54 +1,54 @@
-# -*- coding: utf-8 -*-
-#
-# Licensed under the terms of the BSD 3-Clause
-# (see guidata/LICENSE for details)
-
-"""
-DataSet objects inheritance test
-
-From time to time, it may be useful to derive a DataSet from another. The main
-application is to extend a parameter set with additionnal parameters.
-"""
-
-# guitest: show
-
-import guidata.dataset as gds
-from guidata.env import execenv
-from guidata.qthelpers import qt_app_context
-
-
-class OriginalDataset(gds.DataSet):
- """Original dataset
- This is the original dataset"""
-
- bool = gds.BoolItem("Boolean")
- string = gds.StringItem("String")
- text = gds.TextItem("Text")
- float = gds.FloatItem("Float", default=0.5, min=0, max=1, step=0.01, slider=True)
-
-
-class DerivedDataset(OriginalDataset):
- """Derived dataset
- This is the derived dataset"""
-
- bool = gds.BoolItem("Boolean (modified in derived dataset)")
- a = gds.FloatItem("Level 1 (added in derived dataset)", default=0)
- b = gds.FloatItem("Level 2 (added in derived dataset)", default=0)
- c = gds.FloatItem("Level 3 (added in derived dataset)", default=0)
-
-
-def test_inheritance():
- """Test DataSet inheritance"""
- with qt_app_context():
- e = OriginalDataset()
- e.edit()
- execenv.print(e)
-
- e = DerivedDataset()
- e.edit()
- execenv.print(e)
- execenv.print("OK")
-
-
-if __name__ == "__main__":
- test_inheritance()
+# -*- coding: utf-8 -*-
+#
+# Licensed under the terms of the BSD 3-Clause
+# (see guidata/LICENSE for details)
+
+"""
+DataSet objects inheritance test
+
+From time to time, it may be useful to derive a DataSet from another. The main
+application is to extend a parameter set with additionnal parameters.
+"""
+
+# guitest: show
+
+import guidata.dataset as gds
+from guidata.env import execenv
+from guidata.qthelpers import qt_app_context
+
+
+class OriginalDataset(gds.DataSet):
+ """Original dataset
+ This is the original dataset"""
+
+ bool = gds.BoolItem("Boolean")
+ string = gds.StringItem("String")
+ text = gds.TextItem("Text")
+ float = gds.FloatItem("Float", default=0.5, min=0, max=1, step=0.01, slider=True)
+
+
+class DerivedDataset(OriginalDataset):
+ """Derived dataset
+ This is the derived dataset"""
+
+ bool = gds.BoolItem("Boolean (modified in derived dataset)")
+ a = gds.FloatItem("Level 1 (added in derived dataset)", default=0)
+ b = gds.FloatItem("Level 2 (added in derived dataset)", default=0)
+ c = gds.FloatItem("Level 3 (added in derived dataset)", default=0)
+
+
+def test_inheritance():
+ """Test DataSet inheritance"""
+ with qt_app_context():
+ e = OriginalDataset()
+ e.edit()
+ execenv.print(e)
+
+ e = DerivedDataset()
+ e.edit()
+ execenv.print(e)
+ execenv.print("OK")
+
+
+if __name__ == "__main__":
+ test_inheritance()
diff --git a/guidata/tests/test_item_order.py b/guidata/tests/dataset/test_item_order.py
similarity index 100%
rename from guidata/tests/test_item_order.py
rename to guidata/tests/dataset/test_item_order.py
diff --git a/guidata/tests/test_loadsave_hdf5.py b/guidata/tests/dataset/test_loadsave_hdf5.py
similarity index 94%
rename from guidata/tests/test_loadsave_hdf5.py
rename to guidata/tests/dataset/test_loadsave_hdf5.py
index 76dd399..5afa6d0 100644
--- a/guidata/tests/test_loadsave_hdf5.py
+++ b/guidata/tests/dataset/test_loadsave_hdf5.py
@@ -18,7 +18,7 @@
from guidata.dataset.io import HDF5Reader, HDF5Writer
from guidata.env import execenv
from guidata.qthelpers import qt_app_context
-from guidata.tests.test_all_items import Parameters
+from guidata.tests.dataset.test_all_items import Parameters
def test_loadsave_hdf5():
diff --git a/guidata/tests/test_loadsave_json.py b/guidata/tests/dataset/test_loadsave_json.py
similarity index 94%
rename from guidata/tests/test_loadsave_json.py
rename to guidata/tests/dataset/test_loadsave_json.py
index cf87582..a806ffa 100644
--- a/guidata/tests/test_loadsave_json.py
+++ b/guidata/tests/dataset/test_loadsave_json.py
@@ -17,7 +17,7 @@
from guidata.dataset.io import JSONReader, JSONWriter
from guidata.env import execenv
from guidata.qthelpers import qt_app_context
-from guidata.tests.test_all_items import Parameters
+from guidata.tests.dataset.test_all_items import Parameters
def test_loadsave_json():
diff --git a/guidata/tests/test_rotatedlabel.py b/guidata/tests/dataset/test_rotatedlabel.py
similarity index 96%
rename from guidata/tests/test_rotatedlabel.py
rename to guidata/tests/dataset/test_rotatedlabel.py
index 82b89c1..366ae72 100644
--- a/guidata/tests/test_rotatedlabel.py
+++ b/guidata/tests/dataset/test_rotatedlabel.py
@@ -1,53 +1,53 @@
-# -*- coding: utf-8 -*-
-#
-# Licensed under the terms of the BSD 3-Clause
-# (see guidata/LICENSE for details)
-
-"""
-RotatedLabel test
-
-RotatedLabel is derived from QLabel: it provides rotated text display.
-"""
-
-# guitest: show
-
-from qtpy.QtCore import Qt
-from qtpy.QtWidgets import QFrame, QGridLayout
-
-from guidata.env import execenv
-from guidata.qthelpers import qt_app_context, win32_fix_title_bar_background
-from guidata.widgets.rotatedlabel import RotatedLabel
-
-
-class Frame(QFrame):
- """Test frame"""
-
- def __init__(self, parent=None):
- QFrame.__init__(self, parent)
- win32_fix_title_bar_background(self)
- layout = QGridLayout()
- self.setLayout(layout)
- angle = 0
- for row in range(7):
- for column in range(7):
- layout.addWidget(
- RotatedLabel(
- "Label %03d°" % angle, angle=angle, color=Qt.blue, bold=True
- ),
- row,
- column,
- Qt.AlignCenter,
- )
- angle += 10
-
-
-def test_rotatedlabel():
- """Test RotatedLabel"""
- with qt_app_context(exec_loop=True):
- frame = Frame()
- frame.show()
- execenv.print("OK")
-
-
-if __name__ == "__main__":
- test_rotatedlabel()
+# -*- coding: utf-8 -*-
+#
+# Licensed under the terms of the BSD 3-Clause
+# (see guidata/LICENSE for details)
+
+"""
+RotatedLabel test
+
+RotatedLabel is derived from QLabel: it provides rotated text display.
+"""
+
+# guitest: show
+
+from qtpy.QtCore import Qt
+from qtpy.QtWidgets import QFrame, QGridLayout
+
+from guidata.env import execenv
+from guidata.qthelpers import qt_app_context, win32_fix_title_bar_background
+from guidata.widgets.rotatedlabel import RotatedLabel
+
+
+class Frame(QFrame):
+ """Test frame"""
+
+ def __init__(self, parent=None):
+ QFrame.__init__(self, parent)
+ win32_fix_title_bar_background(self)
+ layout = QGridLayout()
+ self.setLayout(layout)
+ angle = 0
+ for row in range(7):
+ for column in range(7):
+ layout.addWidget(
+ RotatedLabel(
+ "Label %03d°" % angle, angle=angle, color=Qt.blue, bold=True
+ ),
+ row,
+ column,
+ Qt.AlignCenter,
+ )
+ angle += 10
+
+
+def test_rotatedlabel():
+ """Test RotatedLabel"""
+ with qt_app_context(exec_loop=True):
+ frame = Frame()
+ frame.show()
+ execenv.print("OK")
+
+
+if __name__ == "__main__":
+ test_rotatedlabel()
diff --git a/guidata/tests/unit/__init__.py b/guidata/tests/unit/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/guidata/tests/test_config.py b/guidata/tests/unit/test_config.py
similarity index 90%
rename from guidata/tests/test_config.py
rename to guidata/tests/unit/test_config.py
index b9b55eb..70ee13c 100644
--- a/guidata/tests/test_config.py
+++ b/guidata/tests/unit/test_config.py
@@ -1,48 +1,48 @@
-# -*- coding: utf-8 -*-
-#
-# Licensed under the terms of the BSD 3-Clause
-# (see guidata/LICENSE for details)
-
-"""Config test"""
-
-import pytest
-
-from guidata.config import UserConfig
-from guidata.tests.test_all_features import Parameters
-
-
-@pytest.fixture()
-def config():
- """Create a config object"""
- CONF = UserConfig({})
- eta = Parameters()
- eta.write_config(CONF, "TestParameters", "")
- yield CONF
-
-
-def test_load(config):
- """Test load config"""
- eta = Parameters()
- eta.read_config(config, "TestParameters", "")
-
-
-def test_default(config):
- """Test default config"""
- eta = Parameters()
- eta.write_config(config, "etagere2", "")
- eta = Parameters()
- eta.read_config(config, "etagere2", "")
-
-
-def test_restore(config):
- """Test restore config"""
- eta = Parameters()
- eta.fl2 = 2
- eta.integer = 6
- eta.write_config(config, "etagere3", "")
-
- eta = Parameters()
- eta.read_config(config, "etagere3", "")
-
- assert eta.fl2 == 2.0
- assert eta.integer == 6
+# -*- coding: utf-8 -*-
+#
+# Licensed under the terms of the BSD 3-Clause
+# (see guidata/LICENSE for details)
+
+"""Config test"""
+
+import pytest
+
+from guidata.config import UserConfig
+from guidata.tests.dataset.test_all_features import Parameters
+
+
+@pytest.fixture()
+def config():
+ """Create a config object"""
+ CONF = UserConfig({})
+ eta = Parameters()
+ eta.write_config(CONF, "TestParameters", "")
+ yield CONF
+
+
+def test_load(config):
+ """Test load config"""
+ eta = Parameters()
+ eta.read_config(config, "TestParameters", "")
+
+
+def test_default(config):
+ """Test default config"""
+ eta = Parameters()
+ eta.write_config(config, "etagere2", "")
+ eta = Parameters()
+ eta.read_config(config, "etagere2", "")
+
+
+def test_restore(config):
+ """Test restore config"""
+ eta = Parameters()
+ eta.fl2 = 2
+ eta.integer = 6
+ eta.write_config(config, "etagere3", "")
+
+ eta = Parameters()
+ eta.read_config(config, "etagere3", "")
+
+ assert eta.fl2 == 2.0
+ assert eta.integer == 6
diff --git a/guidata/tests/test_data.py b/guidata/tests/unit/test_data.py
similarity index 96%
rename from guidata/tests/test_data.py
rename to guidata/tests/unit/test_data.py
index aebf3aa..4c11ceb 100644
--- a/guidata/tests/test_data.py
+++ b/guidata/tests/unit/test_data.py
@@ -1,53 +1,53 @@
-# -*- coding: utf-8 -*-
-#
-# Licensed under the terms of the BSD 3-Clause
-# (see guidata/LICENSE for details)
-
-"""Unit tests"""
-
-
-import unittest
-
-import guidata.dataset as gds
-from guidata.dataset.conv import update_dataset
-from guidata.env import execenv
-
-
-class Parameters(gds.DataSet):
- """Example dataset"""
-
- float1 = gds.FloatItem("float #1", min=1, max=250, help="height in cm")
- float2 = gds.FloatItem("float #2", min=1, max=250, help="width in cm")
- number = gds.IntItem("number", min=3, max=20)
-
-
-class TestCheck(unittest.TestCase):
- def test_range(self):
- """Test range checking of FloatItem"""
- e = Parameters()
- e.float1 = 150.0
- e.float2 = 400.0
- e.number = 4
- errors = e.check()
- self.assertEqual(errors, ["float2"])
-
- def test_typechecking(self):
- """Test type checking of FloatItem"""
- e = Parameters()
- e.float1 = 150
- e.float2 = 400
- e.number = 4.0
- errors = e.check()
- self.assertEqual(errors, ["float1", "float2", "number"])
-
- def test_update(self):
- e1 = Parameters()
- e2 = Parameters()
- e1.float1 = 23
- update_dataset(e2, e1)
- self.assertEqual(e2.float1, 23)
-
-
-if __name__ == "__main__":
- unittest.main()
- execenv.print("OK")
+# -*- coding: utf-8 -*-
+#
+# Licensed under the terms of the BSD 3-Clause
+# (see guidata/LICENSE for details)
+
+"""Unit tests"""
+
+
+import unittest
+
+import guidata.dataset as gds
+from guidata.dataset.conv import update_dataset
+from guidata.env import execenv
+
+
+class Parameters(gds.DataSet):
+ """Example dataset"""
+
+ float1 = gds.FloatItem("float #1", min=1, max=250, help="height in cm")
+ float2 = gds.FloatItem("float #2", min=1, max=250, help="width in cm")
+ number = gds.IntItem("number", min=3, max=20)
+
+
+class TestCheck(unittest.TestCase):
+ def test_range(self):
+ """Test range checking of FloatItem"""
+ e = Parameters()
+ e.float1 = 150.0
+ e.float2 = 400.0
+ e.number = 4
+ errors = e.check()
+ self.assertEqual(errors, ["float2"])
+
+ def test_typechecking(self):
+ """Test type checking of FloatItem"""
+ e = Parameters()
+ e.float1 = 150
+ e.float2 = 400
+ e.number = 4.0
+ errors = e.check()
+ self.assertEqual(errors, ["float1", "float2", "number"])
+
+ def test_update(self):
+ e1 = Parameters()
+ e2 = Parameters()
+ e1.float1 = 23
+ update_dataset(e2, e1)
+ self.assertEqual(e2.float1, 23)
+
+
+if __name__ == "__main__":
+ unittest.main()
+ execenv.print("OK")
diff --git a/guidata/tests/test_dataset_from_dict.py b/guidata/tests/unit/test_dataset_from_dict.py
similarity index 100%
rename from guidata/tests/test_dataset_from_dict.py
rename to guidata/tests/unit/test_dataset_from_dict.py
diff --git a/guidata/tests/test_dataset_from_func.py b/guidata/tests/unit/test_dataset_from_func.py
similarity index 100%
rename from guidata/tests/test_dataset_from_func.py
rename to guidata/tests/unit/test_dataset_from_func.py
diff --git a/guidata/tests/test_disthelpers.py b/guidata/tests/unit/test_disthelpers.py
similarity index 95%
rename from guidata/tests/test_disthelpers.py
rename to guidata/tests/unit/test_disthelpers.py
index 582e4ac..812dae3 100644
--- a/guidata/tests/test_disthelpers.py
+++ b/guidata/tests/unit/test_disthelpers.py
@@ -1,40 +1,40 @@
-# -*- coding: utf-8 -*-
-#
-# Licensed under the terms of the BSD 3-Clause
-# (see guidata/LICENSE for details)
-
-"""
-guidata.disthelpers demo
-
-How to create an executable with py2exe or cx_Freeze with less efforts than
-writing a complete setup script.
-"""
-
-# guitest: show
-
-import os.path as osp
-
-import pytest
-
-from guidata.env import execenv
-from guidata.utils.disthelpers import Distribution
-
-
-@pytest.mark.skip(reason="Currently not supporting Python > 3.6")
-def test_disthelpers():
- """Test disthelpers"""
- dist = Distribution()
- dist.setup(
- name="Application demo",
- version="1.0.0",
- description="Application demo based on editgroupbox.py",
- script=osp.join(osp.dirname(__file__), "test_editgroupbox.py"),
- target_name="demo.exe",
- )
- dist.add_modules("guidata")
- dist.build("cx_Freeze")
- execenv.print("OK")
-
-
-if __name__ == "__main__":
- test_disthelpers()
+# -*- coding: utf-8 -*-
+#
+# Licensed under the terms of the BSD 3-Clause
+# (see guidata/LICENSE for details)
+
+"""
+guidata.disthelpers demo
+
+How to create an executable with py2exe or cx_Freeze with less efforts than
+writing a complete setup script.
+"""
+
+# guitest: show
+
+import os.path as osp
+
+import pytest
+
+from guidata.env import execenv
+from guidata.utils.disthelpers import Distribution
+
+
+@pytest.mark.skip(reason="Currently not supporting Python > 3.6")
+def test_disthelpers():
+ """Test disthelpers"""
+ dist = Distribution()
+ dist.setup(
+ name="Application demo",
+ version="1.0.0",
+ description="Application demo based on editgroupbox.py",
+ script=osp.join(osp.dirname(__file__), "test_editgroupbox.py"),
+ target_name="demo.exe",
+ )
+ dist.add_modules("guidata")
+ dist.build("cx_Freeze")
+ execenv.print("OK")
+
+
+if __name__ == "__main__":
+ test_disthelpers()
diff --git a/guidata/tests/test_genreqs.py b/guidata/tests/unit/test_genreqs.py
similarity index 100%
rename from guidata/tests/test_genreqs.py
rename to guidata/tests/unit/test_genreqs.py
diff --git a/guidata/tests/test_no_qt.py b/guidata/tests/unit/test_no_qt.py
similarity index 100%
rename from guidata/tests/test_no_qt.py
rename to guidata/tests/unit/test_no_qt.py
diff --git a/guidata/tests/test_text.py b/guidata/tests/unit/test_text.py
similarity index 100%
rename from guidata/tests/test_text.py
rename to guidata/tests/unit/test_text.py
diff --git a/guidata/tests/test_translations.py b/guidata/tests/unit/test_translations.py
similarity index 95%
rename from guidata/tests/test_translations.py
rename to guidata/tests/unit/test_translations.py
index a785acc..ae4cd38 100644
--- a/guidata/tests/test_translations.py
+++ b/guidata/tests/unit/test_translations.py
@@ -1,24 +1,24 @@
-# -*- coding: utf-8 -*-
-#
-# Licensed under the terms of the BSD 3-Clause
-# (see guidata/LICENSE for details)
-
-"""Little translation test"""
-
-# guitest: show
-
-from guidata.config import _
-from guidata.env import execenv
-
-translations = (_("Some required entries are incorrect"),)
-
-
-def test_translations():
- """Test translations"""
- for text in translations:
- execenv.print(text)
- execenv.print("OK")
-
-
-if __name__ == "__main__":
- test_translations()
+# -*- coding: utf-8 -*-
+#
+# Licensed under the terms of the BSD 3-Clause
+# (see guidata/LICENSE for details)
+
+"""Little translation test"""
+
+# guitest: show
+
+from guidata.config import _
+from guidata.env import execenv
+
+translations = (_("Some required entries are incorrect"),)
+
+
+def test_translations():
+ """Test translations"""
+ for text in translations:
+ execenv.print(text)
+ execenv.print("OK")
+
+
+if __name__ == "__main__":
+ test_translations()
diff --git a/guidata/tests/test_updaterestoredataset.py b/guidata/tests/unit/test_updaterestoredataset.py
similarity index 97%
rename from guidata/tests/test_updaterestoredataset.py
rename to guidata/tests/unit/test_updaterestoredataset.py
index 34a4f31..827bdca 100644
--- a/guidata/tests/test_updaterestoredataset.py
+++ b/guidata/tests/unit/test_updaterestoredataset.py
@@ -12,7 +12,7 @@
import numpy as np
from guidata.dataset.conv import restore_dataset, update_dataset
-from guidata.tests.test_all_items import Parameters
+from guidata.tests.dataset.test_all_items import Parameters
def test_update_restore_dataset():
diff --git a/guidata/tests/test_userconfig_app.py b/guidata/tests/unit/test_userconfig_app.py
similarity index 100%
rename from guidata/tests/test_userconfig_app.py
rename to guidata/tests/unit/test_userconfig_app.py
diff --git a/guidata/tests/widgets/__init__.py b/guidata/tests/widgets/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/guidata/tests/test_arrayeditor.py b/guidata/tests/widgets/test_arrayeditor.py
similarity index 100%
rename from guidata/tests/test_arrayeditor.py
rename to guidata/tests/widgets/test_arrayeditor.py
diff --git a/guidata/tests/test_codeeditor.py b/guidata/tests/widgets/test_codeeditor.py
similarity index 81%
rename from guidata/tests/test_codeeditor.py
rename to guidata/tests/widgets/test_codeeditor.py
index 8ada11d..d52d4b2 100644
--- a/guidata/tests/test_codeeditor.py
+++ b/guidata/tests/widgets/test_codeeditor.py
@@ -10,6 +10,7 @@
# guitest: show
+from guidata.configtools import get_icon
from guidata.env import execenv
from guidata.qthelpers import qt_app_context
from guidata.widgets import codeeditor
@@ -21,6 +22,8 @@ def test_codeeditor():
widget = codeeditor.CodeEditor(language="python")
widget.set_text_from_file(codeeditor.__file__)
widget.resize(800, 600)
+ widget.setWindowTitle("Code editor")
+ widget.setWindowIcon(get_icon("guidata.svg"))
widget.show()
execenv.print("OK")
diff --git a/guidata/tests/test_collectionseditor.py b/guidata/tests/widgets/test_collectionseditor.py
similarity index 100%
rename from guidata/tests/test_collectionseditor.py
rename to guidata/tests/widgets/test_collectionseditor.py
diff --git a/guidata/tests/test_console.py b/guidata/tests/widgets/test_console.py
similarity index 80%
rename from guidata/tests/test_console.py
rename to guidata/tests/widgets/test_console.py
index ddf3da2..5088958 100644
--- a/guidata/tests/test_console.py
+++ b/guidata/tests/widgets/test_console.py
@@ -10,6 +10,7 @@
# guitest: show
+from guidata.configtools import get_icon
from guidata.env import execenv
from guidata.qthelpers import qt_app_context
from guidata.widgets.console import Console
@@ -20,6 +21,8 @@ def test_console():
with qt_app_context(exec_loop=True):
widget = Console(debug=False, multithreaded=True)
widget.resize(800, 600)
+ widget.setWindowTitle("Console")
+ widget.setWindowIcon(get_icon("guidata.svg"))
widget.show()
execenv.print("OK")
diff --git a/guidata/tests/test_dataframeeditor.py b/guidata/tests/widgets/test_dataframeeditor.py
similarity index 100%
rename from guidata/tests/test_dataframeeditor.py
rename to guidata/tests/widgets/test_dataframeeditor.py
diff --git a/guidata/tests/test_importwizard.py b/guidata/tests/widgets/test_importwizard.py
similarity index 100%
rename from guidata/tests/test_importwizard.py
rename to guidata/tests/widgets/test_importwizard.py
diff --git a/guidata/tests/test_objecteditor.py b/guidata/tests/widgets/test_objecteditor.py
similarity index 100%
rename from guidata/tests/test_objecteditor.py
rename to guidata/tests/widgets/test_objecteditor.py