Skip to content

Commit f805f02

Browse files
Skip caget value checks when waveform is length 1
See note in the print() statement for explanation. Also added tests for floating point list passed to waveform
1 parent 049da54 commit f805f02

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

tests/test_records.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,31 @@ def record_values_names(fixture_value):
131131
("strin_utf8", builder.stringIn, "%a€b", "%a€b", str), # Valid UTF-8
132132
("strOut_utf8", builder.stringOut, "%a€b", "%a€b", str), # Valid UTF-8
133133
(
134-
"wIn_list",
134+
"wIn_list_int",
135135
builder.WaveformIn,
136136
[1, 2, 3],
137-
numpy.array([1, 2, 3], dtype=numpy.int64),
137+
numpy.array([1, 2, 3], dtype=numpy.int32),
138138
numpy.ndarray,
139139
),
140140
(
141-
"wOut_list",
141+
"wOut_list_int",
142142
builder.WaveformOut,
143143
[1, 2, 3],
144-
numpy.array([1, 2, 3], dtype=numpy.int64),
144+
numpy.array([1, 2, 3], dtype=numpy.int32),
145+
numpy.ndarray,
146+
),
147+
(
148+
"wIn_list_float",
149+
builder.WaveformIn,
150+
[1.5, 2.6, 3.7],
151+
numpy.array([1.5, 2.6, 3.7], dtype=numpy.float64),
152+
numpy.ndarray,
153+
),
154+
(
155+
"wOut_list_float",
156+
builder.WaveformOut,
157+
[1.5, 2.6, 3.7],
158+
numpy.array([1.5, 2.6, 3.7], dtype=numpy.float64),
145159
numpy.ndarray,
146160
),
147161
(
@@ -532,6 +546,17 @@ def run_test_function(
532546
# native types e.g. "+ca_int" -> int
533547
rec_val = +rec_val
534548

549+
if (
550+
creation_func in [builder.WaveformOut, builder.WaveformIn]
551+
and expected_value.dtype in [numpy.float64, numpy.int32]
552+
):
553+
print(
554+
"caget cannot distinguish between a waveform with 1"
555+
"element and a scalar value, and so always returns a "
556+
"scalar. Therefore we skip this check.")
557+
continue
558+
559+
535560
record_value_asserts(
536561
creation_func, rec_val, expected_value, expected_type
537562
)

0 commit comments

Comments
 (0)