diff --git a/tests/analog_functions.py b/tests/analog_functions.py index 8881f049..45a1a54d 100644 --- a/tests/analog_functions.py +++ b/tests/analog_functions.py @@ -1418,14 +1418,11 @@ def check_for_glitch(data, threshold=0.3): if channel is None: # Both channels should idle at 0V before push due to being reset is_idle_ok = is_idle_ok and are_values_within_range(data[:, :2000], -0.20, 0.20, channel) - assert is_idle_ok, "STEP1: Both channels should idle low before push due to being reset" elif channel == libm2k.ANALOG_IN_CHANNEL_1: # CH2 should idle at 0V if we are testing CH1 is_idle_ok = is_idle_ok and are_values_within_range(data, -0.20, 0.20, libm2k.ANALOG_IN_CHANNEL_2) - assert is_idle_ok, "STEP1: CH2 should idle at 0V if we are testing CH1" elif channel == libm2k.ANALOG_IN_CHANNEL_2: is_idle_ok = is_idle_ok and are_values_within_range(data, -0.20, 0.20, libm2k.ANALOG_IN_CHANNEL_1) - assert is_idle_ok, "STEP1: CH1 should idle at 0V if we are testing CH2" # Shoud hold last sample from new buffer for current channel config is_idle_ok = is_idle_ok and are_values_within_range(data[:, -2000:], cfg["amplitude"] * 0.85, cfg["amplitude"] * 1.15, channel) @@ -1448,10 +1445,8 @@ def check_for_glitch(data, threshold=0.3): if channel == libm2k.ANALOG_IN_CHANNEL_1: # CH2 should idle at 0V if we are testing CH1 is_idle_ok = is_idle_ok and are_values_within_range(data, -0.20, 0.20, libm2k.ANALOG_IN_CHANNEL_2) - assert is_idle_ok, "STEP2: CH2 should idle at 0V if we are testing CH1" elif channel == libm2k.ANALOG_IN_CHANNEL_2: is_idle_ok = is_idle_ok and are_values_within_range(data, -0.20, 0.20, libm2k.ANALOG_IN_CHANNEL_1) - assert is_idle_ok, "STEP2: CH1 should idle at 0V if we are testing CH2" glitched = glitched or check_for_glitch(data) if gen_reports: plot_to_file(title=f"Last Sample Hold: {chn_str} - {sr_str} - Falling Ramp", @@ -1472,10 +1467,8 @@ def check_for_glitch(data, threshold=0.3): if channel == libm2k.ANALOG_IN_CHANNEL_1: # CH2 should idle at 0V if we are testing CH1 is_idle_ok = is_idle_ok and are_values_within_range(data, -0.20, 0.20, libm2k.ANALOG_IN_CHANNEL_2) - assert is_idle_ok, "STEP3: CH2 should idle at 0V if we are testing CH1" elif channel == libm2k.ANALOG_IN_CHANNEL_2: is_idle_ok = is_idle_ok and are_values_within_range(data, -0.20, 0.20, libm2k.ANALOG_IN_CHANNEL_1) - assert is_idle_ok, "STEP3: CH1 should idle at 0V if we are testing CH2" glitched = glitched or check_for_glitch(data) if gen_reports: plot_to_file(title=f"Last Sample Hold: {chn_str} - {sr_str} - Rising Ramp", @@ -1496,10 +1489,8 @@ def check_for_glitch(data, threshold=0.3): if channel == libm2k.ANALOG_IN_CHANNEL_1: # CH2 should idle at 0V if we are testing CH1 is_idle_ok = is_idle_ok and are_values_within_range(data, -0.20, 0.20, libm2k.ANALOG_IN_CHANNEL_2) - assert is_idle_ok, "STEP4: CH2 should idle at 0V if we are testing CH1" elif channel == libm2k.ANALOG_IN_CHANNEL_2: is_idle_ok = is_idle_ok and are_values_within_range(data, -0.20, 0.20, libm2k.ANALOG_IN_CHANNEL_1) - assert is_idle_ok, "STEP4: CH1 should idle at 0V if we are testing CH2" glitched = glitched or check_for_glitch(data) if gen_reports: plot_to_file(title=f"Last Sample Hold: {chn_str} - {sr_str} - Falling Ramp", diff --git a/tests/dual_board/.gitignore b/tests/dual_board/.gitignore new file mode 100644 index 00000000..b65cf752 --- /dev/null +++ b/tests/dual_board/.gitignore @@ -0,0 +1 @@ +results* \ No newline at end of file diff --git a/tests/m2k_digital_test.py b/tests/m2k_digital_test.py index 553d06dd..0869ee16 100644 --- a/tests/m2k_digital_test.py +++ b/tests/m2k_digital_test.py @@ -1,7 +1,15 @@ import unittest import libm2k -from digital_functions import set_digital_trigger, check_digital_channels_state, check_digital_output, \ - check_digital_trigger, check_open_drain_mode, test_kernel_buffers, test_pattern_generator_pulse +from digital_functions import ( + check_digital_channels_state, + check_digital_output, + check_digital_trigger, + check_open_drain_mode, + set_digital_trigger, + test_kernel_buffers, + test_last_sample_hold, + test_pattern_generator_pulse, +) from digital_functions import test_digital_cyclic_buffer import reset_def_values as reset from open_context import ctx, dig, d_trig @@ -81,4 +89,4 @@ def test_last_sample_hold(self): # All channels result_ok = test_last_sample_hold(dig, d_trig, ctx, None) with self.subTest(msg="DIO all"): - self.assertEqual(result_ok, True, f"Failed to hold the last sample on all DIO test") \ No newline at end of file + self.assertEqual(result_ok, True, f"Failed to hold the last sample on all DIO test")