Skip to content

Commit

Permalink
really allow in-range validator for txt
Browse files Browse the repository at this point in the history
just enabling the linter
galaxyproject#18403 was not sufficient
  • Loading branch information
bernt-matthias committed Jun 17, 2024
1 parent 3e403e0 commit a2d1a5d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/galaxy/tools/parameters/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def __init__(self, message, range_min, range_max, exclude_min=False, exclude_max
op1 = "<"
if self.exclude_max:
op2 = "<"
expression = f"float('{self.min}') {op1} value {op2} float('{self.max}')"
expression = f"float('{self.min}') {op1} float(value) {op2} float('{self.max}')"
if message is None:
message = f"Value ('%s') must {'not ' if negate == 'true' else ''}fulfill {expression}"
super().__init__(message, expression, negate)
Expand Down
4 changes: 2 additions & 2 deletions test/unit/app/tools/test_parameter_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ def test_InRangeValidator(self):
)
p.validate(10)
with self.assertRaisesRegex(
ValueError, r"Parameter blah: Value \('15'\) must not fulfill float\('10'\) < value <= float\('20'\)"
ValueError, r"Parameter blah: Value \('15'\) must not fulfill float\('10'\) < float(value) <= float\('20'\)"
):
p.validate(15)
with self.assertRaisesRegex(
ValueError, r"Parameter blah: Value \('20'\) must not fulfill float\('10'\) < value <= float\('20'\)"
ValueError, r"Parameter blah: Value \('20'\) must not fulfill float\('10'\) < float(value) <= float\('20'\)"
):
p.validate(20)
p.validate(21)
Expand Down

0 comments on commit a2d1a5d

Please sign in to comment.