Package Tests

The Package Tests module provides the package tests for the rocketlogger.data and rocketlogger.calibration modules.

The tests are to be executed using the nosetests and coverage utilities, e.g. using the test_coverage.sh bash script distributed with the package. Further, the package includes a configuration for tox to test against all supported Python installations, and a helper script test_performance.py to test the performance of various file import options on your target machine

Data Tests

RocketLogger data file import tests.

Copyright (c) 2016-2020, ETH Zurich, Computer Engineering Group All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

class tests.test_data.TestChannelHandling(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_channel_add()[source]
test_channel_add_binary()[source]
test_channel_add_existing()[source]
test_channel_add_invalid_data_size()[source]
test_channel_add_invalid_info()[source]
test_channel_add_invalid_name()[source]
test_channel_add_invalid_scale()[source]
test_channel_add_invalid_unit()[source]
test_channel_add_no_data_size()[source]
test_channel_add_no_name()[source]
test_channel_add_no_scale()[source]
test_channel_add_no_unit()[source]
test_channel_add_overlength_name()[source]
test_channel_add_remove()[source]
test_channel_remove()[source]
test_channel_remove_inexistent()[source]
test_get_channel_name()[source]
test_get_channel_name_list()[source]
test_get_invalid_channel_index()[source]
test_get_single_channel_index()[source]
class tests.test_data.TestChannelMerge(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_channel_names()[source]
test_merge_calculation_overflow()[source]
test_merge_channel_count()[source]
test_merge_drop_channel_names()[source]
test_merge_drop_merge_again()[source]
test_merge_header_only()[source]
test_merge_inexistent_channels()[source]
test_merge_keep_calculation_overflow()[source]
test_merge_keep_channel_count()[source]
test_merge_keep_channel_names()[source]
test_merge_keep_merge_again()[source]
class tests.test_data.TestDataHandling(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_get_all_channels()[source]
test_get_all_channels_unit()[source]
test_get_all_channels_validity()[source]
test_get_comment()[source]
test_get_filename()[source]
test_get_invalid_channel()[source]
test_get_invalid_channel_unit()[source]
test_get_invalid_channel_validity()[source]
test_get_set_of_channels()[source]
test_get_set_of_channels_unit()[source]
test_get_set_of_channels_validity()[source]
test_get_single_channel()[source]
test_get_single_channel_unit()[source]
test_get_single_channel_validity()[source]
test_get_time_absolute_local()[source]
test_get_time_absolute_local_scaling()[source]
test_get_time_absolute_network()[source]
test_get_time_absolute_network_scaling()[source]
test_get_time_default()[source]
test_get_time_invalid_reference()[source]
test_get_time_relative()[source]
test_get_time_relative_scaling()[source]
test_header_dict()[source]
test_load()[source]
class tests.test_data.TestDataPlot(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_header_channel_count()[source]
test_header_field_count()[source]
test_load()[source]
test_plot_all()[source]
test_plot_current()[source]
test_plot_digital()[source]
test_plot_invalid()[source]
test_plot_merged()[source]
test_plot_multi_single()[source]
test_plot_single()[source]
test_plot_voltage()[source]
class tests.test_data.TestDataPlotDecimate(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_header_channel_count()[source]
test_header_field_count()[source]
test_load()[source]
test_plot_all()[source]
test_plot_current()[source]
test_plot_digital()[source]
test_plot_invalid()[source]
test_plot_merged()[source]
test_plot_multi_single()[source]
test_plot_single()[source]
test_plot_voltage()[source]
class tests.test_data.TestDataframe(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_get_absolute_local_time()[source]
test_get_absolute_network_time()[source]
test_get_all_channels()[source]
test_get_dataframe()[source]
test_get_default_time()[source]
test_get_invalid_channel()[source]
test_get_relative_time()[source]
test_get_set_of_channels()[source]
test_get_single_channel()[source]
test_load()[source]
class tests.test_data.TestDecimation(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_binary_decimation()[source]
test_max_decimation()[source]
test_mean_decimation()[source]
test_min_decimation()[source]
class tests.test_data.TestFileImport(methodName='runTest')[source]

Bases: unittest.case.TestCase

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_direct_import()[source]
test_direct_import_with_decimation()[source]
test_direct_vs_memory_mapped()[source]
test_header_dict()[source]
test_header_dict_with_decimation()[source]
test_inexistent_file()[source]
test_invalid_header_comment_length()[source]
test_invalid_header_data_block_count()[source]
test_invalid_header_data_block_size()[source]
test_invalid_header_data_sample_count()[source]
test_invalid_header_length()[source]
test_invalid_header_magic()[source]
test_invalid_header_sample_count_inconsistent()[source]
test_invalid_header_version()[source]
test_min_block_size_import()[source]
test_no_file()[source]
test_normal()[source]
test_overload_existing()[source]
test_single_block_import()[source]
test_with_decimation()[source]
test_with_invalid_decimation()[source]
class tests.test_data.TestFullFile(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_channel_names()[source]
test_data_size()[source]
test_header_channel_count()[source]
test_header_field_count()[source]
test_load()[source]
class tests.test_data.TestHeaderOnlyImport(methodName='runTest')[source]

Bases: unittest.case.TestCase

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_direct_import()[source]
test_direct_import_with_decimation()[source]
test_get_all_channels_unit()[source]
test_get_data()[source]
test_get_invalid_channel_unit()[source]
test_get_set_of_channels_unit()[source]
test_get_single_channel_unit()[source]
test_get_time()[source]
test_get_validity()[source]
test_header_dict()[source]
test_header_dict_with_decimation()[source]
test_inexistent_file()[source]
test_invalid_header_comment_length()[source]
test_invalid_header_data_block_count()[source]
test_invalid_header_data_block_size()[source]
test_invalid_header_data_sample_count()[source]
test_invalid_header_length()[source]
test_invalid_header_magic()[source]
test_invalid_header_sample_count_inconsistent()[source]
test_invalid_header_version()[source]
test_no_file()[source]
test_normal()[source]
test_overload_existing()[source]
test_single_block_import()[source]
test_with_decimation()[source]
test_with_invalid_decimation()[source]
class tests.test_data.TestJoinExclude(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_exclude_all()[source]
test_exclude_non_join()[source]
class tests.test_data.TestJoinExcludeArray(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_data_timestamp_monotonic()[source]
test_data_timestamp_realtime()[source]
test_data_values()[source]
test_load()[source]
class tests.test_data.TestJoinExcludeFirst(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_data_timestamp_monotonic()[source]
test_data_timestamp_realtime()[source]
test_data_values()[source]
test_load()[source]
class tests.test_data.TestJoinExcludeInt(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_data_timestamp_monotonic()[source]
test_data_timestamp_realtime()[source]
test_data_values()[source]
test_load()[source]
class tests.test_data.TestJoinExcludeLast(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_data_timestamp_monotonic()[source]
test_data_timestamp_realtime()[source]
test_data_values()[source]
test_load()[source]
class tests.test_data.TestJoinExcludeList(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_data_timestamp_monotonic()[source]
test_data_timestamp_realtime()[source]
test_data_values()[source]
test_load()[source]
class tests.test_data.TestJoinExcludeMultiple(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_data_timestamp_monotonic()[source]
test_data_timestamp_realtime()[source]
test_data_values()[source]
test_load()[source]
class tests.test_data.TestJoinFile(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_channel_names()[source]
test_data_size()[source]
test_header_channel_count()[source]
test_header_field_count()[source]
test_load()[source]
class tests.test_data.TestJoinMissmatch(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_exclude_all()[source]
class tests.test_data.TestNoJoinFile(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_channel_names()[source]
test_data_size()[source]
test_header_channel_count()[source]
test_header_field_count()[source]
test_load()[source]
class tests.test_data.TestRecoveryFile(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_direct_import()[source]
test_direct_import_with_decimation()[source]
test_header_dict()[source]
test_header_dict_with_decimation()[source]
test_no_recovery()[source]
test_with_decimation()[source]
test_with_invalid_decimation()[source]
class tests.test_data.TestRecoverySplitFile(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_direct_import()[source]
test_direct_import_with_decimation()[source]
test_header_dict()[source]
test_header_dict_with_decimation()[source]
test_no_recovery()[source]
test_with_decimation()[source]
test_with_invalid_decimation()[source]
class tests.test_data.TestSingleChannelFile(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_channel_names()[source]
test_data_size()[source]
test_header_channel_count()[source]
test_header_field_count()[source]
test_load()[source]

Calibration Tests

RocketLogger calibration tests.

Copyright (c) 2019-2020, ETH Zurich, Computer Engineering Group All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

class tests.test_calibration.TestCalibrationFile(methodName='runTest')[source]

Bases: unittest.case.TestCase

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_compare_design_read()[source]
test_compare_empty_design()[source]
test_compare_empty_different_type()[source]
test_compare_empty_empty()[source]
test_compare_empty_read()[source]
test_compare_read()[source]
test_compare_read_direct()[source]
test_compare_read_to_empty()[source]
test_file_read()[source]
test_file_read_direct()[source]
test_file_write_empty()[source]
test_file_write_reread()[source]
test_file_write_reread_design()[source]
test_invalid_header_length()[source]
test_invalid_header_magic()[source]
test_invalid_header_version()[source]
class tests.test_calibration.TestCalibrationProcedure(methodName='runTest')[source]

Bases: unittest.case.TestCase

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_calibration_by_data()[source]
test_calibration_by_data_direct()[source]
test_calibration_by_filename()[source]
test_calibration_by_filename_direct()[source]
test_calibration_empty()[source]
test_calibration_file_channel_missing()[source]
test_calibration_file_missing()[source]
test_calibration_invalid_target_offset_error()[source]
test_calibration_print_stat()[source]
test_calibration_print_stat_uncalibrated()[source]
test_calibration_write_log()[source]
test_calibration_write_reread()[source]
class tests.test_calibration.TestCalibrationSetup(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_SMU2450_setup_current_high_setpoints()[source]
test_SMU2450_setup_current_low_setpoints()[source]
test_SMU2450_setup_setpoint_count()[source]
test_SMU2450_setup_voltage_setpoints()[source]
test_basic_setup_current_high_setpoints()[source]
test_basic_setup_current_low_setpoints()[source]
test_basic_setup_setpoint_count()[source]
test_basic_setup_voltage_setpoints()[source]
test_calibration_setup_dual()[source]
test_calibration_setup_dual_invalid()[source]
test_calibration_setup_empty()[source]
test_calibration_setup_single()[source]
test_calibration_setup_single_invalid()[source]
test_setpoint_detection_invalid_scale()[source]
test_setpoint_detection_size()[source]
test_setpoint_detection_zero_length_filter()[source]
class tests.test_calibration.TestUnsupportedCalibrationFile(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_file_read()[source]
test_file_read_direct()[source]