Skip to content

Commit 1c27e84

Browse files
committed
add tests for negative axis range values in range restriction sub-space requests
1 parent 14077ee commit 1c27e84

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/test_models_designaxis.py

+23
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,29 @@ def test_designaxis_model_parse_subspace_range_pass(qtbot):
316316
# default value should match string
317317
assert match[1] == passing_value[2]
318318

319+
negative_values = [
320+
# negative values on slnt axis
321+
("-10:0", (-10.0, 0.0), None),
322+
("-10.0:0", (-10.0, 0.0), None),
323+
("-10 : 0", (-10.0, 0.0), None),
324+
# mock negative max end using signed zero
325+
("-10:-0", (-10.0, -0.0), None),
326+
("-10.0:-0.0", (-10.0, -0.0), None),
327+
("-10.0 : -0.0", (-10.0, -0.0), None),
328+
# test negative default
329+
("-10:-0 [-5]", (-10.0, -0.0), "-5"),
330+
("-10:-0 [ -5 ]", (-10.0, -0.0), "-5"),
331+
("-10.0 : -0.0 [ -5.0 ]", (-10.0, -0.0), "-5.0"),
332+
]
333+
334+
for negative_value in negative_values:
335+
# switch to slnt axis for these tests
336+
match = model.parse_subspace_range(negative_value[0], "slnt")
337+
# range should match tuple
338+
assert match[0] == negative_value[1]
339+
# default value should match string
340+
assert match[1] == negative_value[2]
341+
319342

320343
def test_designaxis_model_parse_subspace_range_fail_invalid_syntax(qtbot):
321344
tableview = QTableView()

0 commit comments

Comments
 (0)