示例#1
0
    def test_series_measurement_one_in_queue(self, mock_waveform_thread,
                                             log_checker):

        # setup
        handler = MeasurementHandler()
        print(handler._queue)

        handler.add_to_queue(self.lp.create_waveform(), self.settings)
        side_effect_array = [
            np.array([[0, 2.5, 4.5, 6.5], [1, 3.5, 5.5, 7.5]])
        ]

        with patch.object(handler, 'single_measurement',
                          side_effect=side_effect_array) as method:
            # perform
            observed_data_list = handler.series_measurement()

        # assert
        for observed_data in observed_data_list:
            np.testing.assert_array_equal(
                observed_data,
                np.array([[0, 2.5, 4.5, 6.5], [1, 3.5, 5.5, 7.5]])
            )

        log_checker.check(
            ('root', 'INFO', 'Measurement #1 complete'),
            ('root', 'INFO', 'Total: 1 measurements performed'),
        )
示例#2
0
    def test_series_measurement_empty_queue(self, mock_waveform_thread,
                                            log_checker):

        handler = MeasurementHandler()

        observed_data_list = handler.series_measurement()
        self.assertEqual(
            len(observed_data_list), 0)

        log_checker.check(
            ('root', 'INFO', 'Total: 0 measurements performed'),
        )