@@ -208,6 +208,33 @@ def table_1_np_arrays() -> OrderedDict[str, Union[List, np.ndarray]]:
208
208
)
209
209
210
210
211
+ @pytest .fixture
212
+ def table_1_np_arrays_int_enums () -> OrderedDict [str , Union [List , np .ndarray ]]:
213
+ # Intentionally not in panda order. Whatever types the np arrays are,
214
+ # the outputs from words_to_table will be uint32 or int32.
215
+ return OrderedDict (
216
+ {
217
+ "POSITION" : np .array ([- 5 , 678 , 0 ], dtype = np .int32 ),
218
+ "TIME1" : np .array ([100 , 0 , 9 ], dtype = np .uint32 ),
219
+ "OUTA1" : np .array ([0 , 1 , 1 ], dtype = np .uint8 ),
220
+ "OUTB1" : np .array ([0 , 0 , 1 ], dtype = np .uint8 ),
221
+ "OUTD1" : np .array ([1 , 0 , 1 ], dtype = np .uint8 ),
222
+ "OUTE1" : np .array ([0 , 0 , 1 ], dtype = np .uint8 ),
223
+ "OUTC1" : np .array ([0 , 0 , 1 ], dtype = np .uint8 ),
224
+ "OUTF1" : np .array ([1 , 0 , 1 ], dtype = np .uint8 ),
225
+ "TIME2" : np .array ([0 , 55 , 9999 ], dtype = np .uint32 ),
226
+ "OUTA2" : np .array ([0 , 0 , 1 ], dtype = np .uint8 ),
227
+ "OUTB2" : np .array ([0 , 0 , 1 ], dtype = np .uint8 ),
228
+ "REPEATS" : np .array ([5 , 0 , 50000 ], dtype = np .uint32 ),
229
+ "OUTC2" : np .array ([1 , 1 , 1 ], dtype = np .uint8 ),
230
+ "OUTD2" : np .array ([0 , 0 , 1 ], dtype = np .uint8 ),
231
+ "OUTE2" : np .array ([0 , 0 , 1 ], dtype = np .uint8 ),
232
+ "OUTF2" : np .array ([1 , 0 , 1 ], dtype = np .uint8 ),
233
+ "TRIGGER" : np .array ([0 , 6 , 0 ], dtype = np .uint8 ),
234
+ }
235
+ )
236
+
237
+
211
238
@pytest .fixture
212
239
def table_1_not_in_panda_order () -> OrderedDict [str , Union [List , np .ndarray ]]:
213
240
return OrderedDict (
@@ -351,6 +378,20 @@ def test_table_packing_unpack(
351
378
np .testing .assert_array_equal (actual , expected )
352
379
353
380
381
+ def test_table_packing_unpack_no_convert_enum (
382
+ table_1_np_arrays_int_enums : OrderedDict [str , np .ndarray ],
383
+ table_field_info : TableFieldInfo ,
384
+ table_data_1 : List [str ],
385
+ ):
386
+ assert table_field_info .row_words
387
+ output_table = words_to_table (table_data_1 , table_field_info )
388
+
389
+ actual : UnpackedArray
390
+ for field_name , actual in output_table .items ():
391
+ expected = table_1_np_arrays_int_enums [str (field_name )]
392
+ np .testing .assert_array_equal (actual , expected )
393
+
394
+
354
395
def test_table_packing_pack (
355
396
table_1 : Dict [str , Union [List , np .ndarray ]],
356
397
table_field_info : TableFieldInfo ,
0 commit comments