Skip to content
Snippets Groups Projects
Commit 5de19d6d authored by Lan Dam's avatar Lan Dam
Browse files

change code to not remove quest_chans that not includes in plotting data

parent c4380a6a
No related branches found
No related tags found
1 merge request!128plot SOH channels in user's order
This commit is part of merge request !128. Comments created here will be created in the context of that merge request.
......@@ -359,9 +359,10 @@ def replace_actual_quest_chans(
for qc in quest_chans:
actual_quest_chans = [c for c in list(actual_chans)
if qc[:-1] == c[:-1]]
quest_idx = chan_order.index(qc)
chan_order.remove(qc)
chan_order[quest_idx:quest_idx] = sorted(actual_quest_chans)
if actual_quest_chans:
quest_idx = chan_order.index(qc)
chan_order.remove(qc)
chan_order[quest_idx:quest_idx] = sorted(actual_quest_chans)
return chan_order
......
......@@ -520,10 +520,18 @@ class RemoveNotFoundChansClass(TestCase):
class ReplaceActualQuestChans(TestCase):
def test_replace_actual_quest_chans(self):
def test_quest_chans_in_actual_chans(self):
chan_order = ['A', 'B', 'C?', 'D']
actual_chans = ['C1', 'C3', 'C2', 'D', 'E', 'F']
expected_new_chan_order = ['A', 'B', 'C1', 'C2', 'C3', 'D']
ret = replace_actual_quest_chans(chan_order, actual_chans)
self.assertListEqual(ret, expected_new_chan_order)
def test_quest_chans_not_in_actual_chans(self):
chan_order = ['A?', 'B', 'C', 'D']
actual_chans = ['C', 'D', 'E', 'F']
expected_new_chan_order = ['A?', 'B', 'C', 'D']
ret = replace_actual_quest_chans(chan_order, actual_chans)
self.assertListEqual(ret, expected_new_chan_order)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment