Skip to content

Commit 0d51903

Browse files
committed
Set guidata validation mode to STRICT in tests
1 parent 12d7d99 commit 0d51903

21 files changed

+114
-100
lines changed

plotpy/config.py

Lines changed: 54 additions & 54 deletions
Large diffs are not rendered by default.

plotpy/items/shape/axis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def __init__(
4949
) -> None:
5050
super().__init__(shapeparam=shapeparam)
5151
self.set_rect(p0, p1, p2)
52-
self.arrow_angle = 15 # degrees
52+
self.arrow_angle = 15.0 # degrees
5353
self.arrow_size = 0.05 # % of axe length
5454
self.x_pen = self.pen
5555
self.x_brush = self.brush

plotpy/styles/axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class AxisParam(DataSet):
4646
scale = ChoiceItem(
4747
_("Scale"), [("lin", _("linear")), ("log", _("logarithmic"))], default="lin"
4848
)
49-
vmin = FloatItem("Min", help=_("Lower axis limit"))
50-
vmax = FloatItem("Max", help=_("Upper axis limit"))
49+
vmin = FloatItem("Min", help=_("Lower axis limit"), default=0.0)
50+
vmax = FloatItem("Max", help=_("Upper axis limit"), default=1.0)
5151

5252
def update_param(self, plot: BasePlot, axis_id: int) -> None:
5353
"""

plotpy/styles/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def update_param(self, symb):
373373
self.marker = MARKER_NAME[symb]
374374
return
375375
self.marker = MARKER_NAME[symb.style()]
376-
self.size = symb.size().width()
376+
self.size = int(symb.size().width())
377377
self.edgecolor = str(symb.pen().color().name())
378378
self.facecolor = str(symb.brush().color().name())
379379

@@ -420,7 +420,7 @@ class SymbolItem(ObjectItem):
420420
class LineStyleParam(DataSet):
421421
style = ImageChoiceItem(_("Style"), LINESTYLE_CHOICES, default="SolidLine")
422422
color = ColorItem(_("Color"), default="black")
423-
width = FloatItem(_("Width"), default=1.0, min=0)
423+
width = FloatItem(_("Width"), default=1.0, min=0.0)
424424

425425
def update_param(self, pen):
426426
"""

plotpy/styles/curve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CurveParam(DataSet):
3939
)
4040
line = LineStyleItem(_("Line"))
4141
symbol = SymbolItem(_("Symbol"))
42-
shade = FloatItem(_("Shadow"), default=0, min=0, max=1)
42+
shade = FloatItem(_("Shadow"), default=0.0, min=0.0, max=1.0)
4343
curvestyle = ImageChoiceItem(_("Curve style"), CURVESTYLE_CHOICES, default="Lines")
4444
baseline = FloatItem(_("Baseline"), default=0.0)
4545
_use_dsamp_prop = GetAttrProp("use_dsamp")

plotpy/styles/errorbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ErrorBarParam(DataSet):
3030
alpha = FloatItem(
3131
_("Alpha"), default=0.9, min=0, max=1, help=_("Error bar transparency")
3232
)
33-
width = FloatItem(_("Width"), default=1.0, min=1)
33+
width = FloatItem(_("Width"), default=1.0, min=1.0)
3434
cap = IntItem(_("Cap"), default=4, min=0)
3535
ontop = BoolItem(_("set to foreground"), _("Visibility"), default=False)
3636

plotpy/styles/image.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ class MaskedImageParamMixin(DataSet):
433433
"""Mixin for masked image parameters."""
434434

435435
g_mask = BeginGroup(_("Mask"))
436-
filling_value = FloatItem(_("Filling value"))
436+
filling_value = FloatItem(_("Filling value"), default=0.0)
437437
show_mask = BoolItem(_("Show image mask"), default=False)
438438
alpha_masked = FloatItem(_("Masked area alpha"), default=0.7, min=0, max=1)
439439
alpha_unmasked = FloatItem(_("Unmasked area alpha"), default=0.0, min=0, max=1)
@@ -501,10 +501,10 @@ class ImageFilterParam(BaseImageParam):
501501

502502
label = StringItem(_("Title"), default=_("Filter"))
503503
g1 = BeginGroup(_("Bounds"))
504-
xmin = FloatItem(_("x|min"))
505-
xmax = FloatItem(_("x|max"))
506-
ymin = FloatItem(_("y|min"))
507-
ymax = FloatItem(_("y|max"))
504+
xmin = FloatItem(_("x|min"), default=0.0)
505+
xmax = FloatItem(_("x|max"), default=1.0)
506+
ymin = FloatItem(_("y|min"), default=0.0)
507+
ymax = FloatItem(_("y|max"), default=1.0)
508508
_g1 = EndGroup("sub-group")
509509
use_source_cmap = BoolItem(
510510
_("Use image colormap and level"), _("Color map"), default=True

plotpy/styles/label.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ class LabelParam(DataSet):
4747
___cont = BeginGroup(_("Contents")).set_prop(
4848
"display", icon="label.png", hide=GetAttrProp("_no_contents")
4949
)
50-
contents = TextItem("").set_prop("display", hide=GetAttrProp("_no_contents"))
50+
contents = TextItem("", default="").set_prop(
51+
"display", hide=GetAttrProp("_no_contents")
52+
)
5153
___econt = EndGroup(_("Contents")).set_prop(
5254
"display", hide=GetAttrProp("_no_contents")
5355
)

plotpy/styles/shape.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,12 @@ def update_shape(self, obj: PolygonShape) -> None:
235235
class AxesShapeParam(DataSet):
236236
"""Parameters for an axes item"""
237237

238-
arrow_angle = FloatItem(_("Arrow angle") + " (°)", min=0, max=90, nonzero=True)
239-
arrow_size = FloatItem(_("Arrow size") + " (%)", min=0, max=100, nonzero=True)
238+
arrow_angle = FloatItem(
239+
_("Arrow angle") + " (°)", min=0.0, max=90.0, default=15.0, nonzero=True
240+
)
241+
arrow_size = FloatItem(
242+
_("Arrow size") + " (%)", min=0.0, max=100.0, default=0.05, nonzero=True
243+
)
240244
_styles = BeginTabGroup("Styles")
241245
# ------------------------------------------------------------------ Line tab
242246
___line = BeginGroup(_("Line")).set_prop("display", icon="dashdot.png")

plotpy/tests/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@
1212
import qwt
1313
import scipy
1414
import tifffile
15+
from guidata.config import ValidationMode, set_validation_mode
1516
from guidata.env import execenv
1617

1718
import plotpy
1819

20+
# Set validation mode to STRICT for the sigima package
21+
set_validation_mode(ValidationMode.STRICT)
22+
1923
# Turn on unattended mode for executing tests without user interaction
2024
execenv.unattended = True
2125
execenv.verbose = "quiet"

0 commit comments

Comments
 (0)