From 52fd51835038750aa09f28c08708857fbafffc0a Mon Sep 17 00:00:00 2001 From: Lan <ldam@passcal.nmt.edu> Date: Thu, 18 May 2023 11:44:53 -0600 Subject: [PATCH] add unittest for new channels --- tests/test_view/test_util_functions.py | 28 +++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tests/test_view/test_util_functions.py b/tests/test_view/test_util_functions.py index bc59a4123..eedfa5481 100644 --- a/tests/test_view/test_util_functions.py +++ b/tests/test_view/test_util_functions.py @@ -9,7 +9,8 @@ from sohstationviewer.view.util.functions import ( get_soh_messages_for_view, log_str, is_doc_file, create_search_results_file, create_table_of_content_file, check_chan_wildcards_format, check_masspos, get_total_miny_maxy, - extract_netcodes, get_index_from_time + extract_netcodes, get_index_from_time, remove_not_found_chans, + replace_actual_quest_chans ) from sohstationviewer.view.util.enums import LogType @@ -501,3 +502,28 @@ class TestGetIndexFromTime(TestCase): self.plotting_data['CH2'], 3, 4) self.assertEqual(list_idx, 1) self.assertEqual(section_idx, 0) + + +class RemoveNotFoundChansClass(TestCase): + def test_remove_not_found_chans(self): + chan_order = ['A', 'B', 'C', 'D'] + actual_chans = ['C', 'D', 'E', 'F'] + processing_log = [] + expected_new_chan_order = ['C', 'D'] + expected_processing_log = [ + ("No data found for the following channels: A, B", + LogType.WARNING)] + + ret = remove_not_found_chans(chan_order, actual_chans, processing_log) + self.assertListEqual(ret, expected_new_chan_order) + self.assertEqual(processing_log, expected_processing_log) + + +class ReplaceActualQuestChans(TestCase): + def test_replace_actual_quest_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) -- GitLab