Skip to content

Commit f127bf2

Browse files
Add support and tests for List[str]
Note that these tests don't currently pass!
1 parent 7d852a0 commit f127bf2

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

softioc/builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def _waveform(value, fields):
221221
initial_value = numpy.require(initial_value, numpy.int32)
222222
elif initial_value.dtype == numpy.uint64:
223223
initial_value = numpy.require(initial_value, numpy.uint32)
224-
elif initial_value.dtype.char == "S":
224+
elif initial_value.dtype.char in ("S", "U"):
225225
initial_value = numpy.require(initial_value, numpy.dtype("S40"))
226226
else:
227227
initial_value = numpy.array([], dtype = datatype)

tests/test_record_values.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,24 @@ def record_values_names(fixture_value):
207207
),
208208
numpy.ndarray,
209209
),
210+
(
211+
"wIn_string_array",
212+
builder.WaveformIn,
213+
["123", "456", "7890"],
214+
numpy.array(
215+
[b"123", b"456", b"7890"], dtype=numpy.dtype("|S40")
216+
),
217+
numpy.ndarray,
218+
),
219+
(
220+
"wOut_string_array",
221+
builder.WaveformOut,
222+
["123", "456", "7890"],
223+
numpy.array(
224+
[b"123", b"456", b"7890"], dtype=numpy.dtype("|S40")
225+
),
226+
numpy.ndarray,
227+
),
210228
(
211229
"longStringIn_str",
212230
builder.longStringIn,

0 commit comments

Comments
 (0)