Skip to content

Commit

Permalink
Changed a test to explicitly define all values on the undefined table…
Browse files Browse the repository at this point in the history
… before submitting it to the panda
  • Loading branch information
evalott100 committed Oct 16, 2023
1 parent 952efe5 commit 1a3877b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 14 deletions.
15 changes: 14 additions & 1 deletion tests/fixtures/mocked_panda.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,20 @@ def multiple_seq_responses(table_field_info, table_data_1, table_data_2):
command_to_key(
Put(
field="SEQ4.TABLE",
value=["0", "0", "0", "0", "1", "0", "0", "0", "0", "0", "0", "0"],
value=[
"2457862149",
"4294967291",
"100",
"0",
"269877248",
"678",
"0",
"55",
"4293968720",
"0",
"9",
"9999",
],
)
): repeat(None),
command_to_key(
Expand Down
50 changes: 37 additions & 13 deletions tests/test_ioc_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ async def test_non_defined_seq_table_can_be_added_to_panda_side(


async def test_non_defined_seq_table_can_be_added_to_ioc_side(
mocked_panda_multiple_seq_responses,
mocked_panda_multiple_seq_responses, table_unpacked_data
):
(
tmp_path,
Expand All @@ -653,10 +653,11 @@ async def test_non_defined_seq_table_can_be_added_to_ioc_side(
test_prefix,
) = mocked_panda_multiple_seq_responses

initial_table_repeats = await caget(
test_prefix + ":SEQ4:TABLE:REPEATS", timeout=TIMEOUT
)
assert list(initial_table_repeats) == []
for field in table_unpacked_data:
initial_table_field = await caget(
test_prefix + ":SEQ4:TABLE:" + field, timeout=TIMEOUT
)
assert list(initial_table_field) == []

initial_table_mode = await caget(test_prefix + ":SEQ4:TABLE:MODE", timeout=TIMEOUT)
assert initial_table_mode == 0 # TableModeEnum.VIEW
Expand All @@ -665,17 +666,40 @@ async def test_non_defined_seq_table_can_be_added_to_ioc_side(
table_mode = await caget(test_prefix + ":SEQ4:TABLE:MODE", timeout=TIMEOUT)
assert table_mode == 1

await caput(
test_prefix + ":SEQ4:TABLE:REPEATS",
numpy.array([0, 1, 0]),
wait=True,
)
curr_val = await caget(test_prefix + ":SEQ4:TABLE:REPEATS", timeout=TIMEOUT)

assert list(curr_val) == [0, 1, 0]
for field, data in table_unpacked_data.items():
await caput(
test_prefix + ":SEQ4:TABLE:" + field,
data,
wait=True,
)

await caput(test_prefix + ":SEQ4:TABLE:MODE", 2, wait=True) # TableModeEnum.SUBMIT

await asyncio.sleep(0.1)
commands_received = multiprocessing_queue_to_list(command_queue)
assert (
command_to_key(
Put(
field="SEQ4.TABLE",
value=[
"2457862149",
"4294967291",
"100",
"0",
"269877248",
"678",
"0",
"55",
"4293968720",
"0",
"9",
"9999",
],
)
)
in commands_received
)


async def test_not_including_number_in_metadata_throws_error(
no_numbered_suffix_to_metadata_responses,
Expand Down

0 comments on commit 1a3877b

Please sign in to comment.