當前位置: 首頁>>代碼示例>>Python>>正文


Python calibration_api.CalibrationAPI類代碼示例

本文整理匯總了Python中peachyprinter.api.calibration_api.CalibrationAPI的典型用法代碼示例。如果您正苦於以下問題:Python CalibrationAPI類的具體用法?Python CalibrationAPI怎麽用?Python CalibrationAPI使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CalibrationAPI類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_current_calibration_returns_the_existing_configuration

    def test_current_calibration_returns_the_existing_configuration(self, *args):
        self.setup_mocks(args)
        expected_config = self.default_config
        self.mock_configuration_manager.load.return_value = expected_config
        calibration_api = CalibrationAPI(self.mock_configuration_manager)

        self.assertEqual(calibration_api.current_calibration(), expected_config.calibration)
開發者ID:BenBlumer,項目名稱:peachyprintertools,代碼行數:7,代碼來源:calibration_api_test.py

示例2: test_change_pattern_should_raise_exception_when_test_patterns_unavailable

    def test_change_pattern_should_raise_exception_when_test_patterns_unavailable(self, *args):
        self.setup_mocks(args)
        self.mock_configuration_manager.load.return_value = self.default_config
        calibration_api = CalibrationAPI(self.mock_configuration_manager)

        with self.assertRaises(Exception):
            calibration_api.show_test_pattern("Shrubberies")
開發者ID:BenBlumer,項目名稱:peachyprintertools,代碼行數:7,代碼來源:calibration_api_test.py

示例3: test_get_points_should_load_points

    def test_get_points_should_load_points(self, *args):
        self.setup_mocks(args)
        expected_lower = {
                (1.0, 1.0): (1.0,  1.0), (0.0, 1.0): (-1.0,  1.0),
                (1.0, 0.0): (1.0, -1.0), (0.0, 0.0): (-1.0, -1.0)
                }
        expected_upper = {
                (1.0, 1.0): (1.0,  1.0), (0.0, 1.0): (-1.0,  1.0),
                (1.0, 0.0): (1.0, -1.0), (0.0, 0.0): (-1.0, -1.0)
                }
        expected_height = 1.1
        config = self.default_config
        config.calibration.height = expected_height
        config.calibration.lower_points = expected_lower
        config.calibration.upper_points = expected_upper

        self.mock_configuration_manager.load.return_value = config

        calibration_api = CalibrationAPI(self.mock_configuration_manager)

        lower_points_result = calibration_api.get_lower_points()
        upper_points_result = calibration_api.get_upper_points()
        height_result = calibration_api.get_height()

        self.assertEquals(expected_height, height_result)
        self.assertEquals(expected_lower, lower_points_result)
        self.assertEquals(expected_upper, upper_points_result)
開發者ID:BenBlumer,項目名稱:peachyprintertools,代碼行數:27,代碼來源:calibration_api_test.py

示例4: test_change_pattern_should_change_pattern_on_controller

    def test_change_pattern_should_change_pattern_on_controller(self, mock_HilbertGenerator, *args):
        self.setup_mocks(args)
        self.mock_configuration_manager.load.return_value = self.default_config

        calibration_api = CalibrationAPI(self.mock_configuration_manager)
        calibration_api.show_test_pattern("Hilbert Space Filling Curve")
        self.mock_controller.change_generator.assert_called_with(self.mock_hilbert_generator)
開發者ID:BenBlumer,項目名稱:peachyprintertools,代碼行數:7,代碼來源:calibration_api_test.py

示例5: test_get_patterns_should_return_available_test_patterns

    def test_get_patterns_should_return_available_test_patterns(self, *args):
        self.setup_mocks(args)
        self.mock_configuration_manager.load.return_value = self.default_config
        calibration_api = CalibrationAPI(self.mock_configuration_manager)

        patterns = calibration_api.get_test_patterns()

        self.assertEquals(set(['Memory Hourglass', 'NESW', 'Damping Test', 'Hilbert Space Filling Curve', 'Spiral', 'Square', 'Circle', 'Twitch']),set(patterns))
開發者ID:BenBlumer,項目名稱:peachyprintertools,代碼行數:8,代碼來源:calibration_api_test.py

示例6: test_stop_should_call_stop_on_controller

    def test_stop_should_call_stop_on_controller(self, *args):
        self.setup_mocks(args)
        self.mock_configuration_manager.load.return_value = self.default_config
        calibration_api = CalibrationAPI(self.mock_configuration_manager)

        calibration_api.close()

        self.mock_controller.close.assert_called_with()
開發者ID:BenBlumer,項目名稱:peachyprintertools,代碼行數:8,代碼來源:calibration_api_test.py

示例7: test_show_line_should_use_OrientationGenerator

    def test_show_line_should_use_OrientationGenerator(self, *args):
        self.setup_mocks(args)
        self.mock_configuration_manager.load.return_value = self.default_config

        calibration_api = CalibrationAPI(self.mock_configuration_manager)

        calibration_api.show_orientation()

        self.mock_controller.change_generator.assert_called_with(self.mock_orientation_generator)
開發者ID:BenBlumer,項目名稱:peachyprintertools,代碼行數:9,代碼來源:calibration_api_test.py

示例8: test_subscribe_to_status_should

    def test_subscribe_to_status_should(self, *args):
        self.setup_mocks(args)
        self.mock_configuration_manager.load.return_value = self.default_config
        calibration_api = CalibrationAPI(self.mock_configuration_manager)
        mock_call_back = MagicMock()

        calibration_api.subscribe_to_status(mock_call_back)

        self.mock_UsbPacketCommunicator.return_value.register_handler.assert_called_with(PrinterStatusMessage, mock_call_back)
開發者ID:BenBlumer,項目名稱:peachyprintertools,代碼行數:9,代碼來源:calibration_api_test.py

示例9: test_show_point_should_replace_controllers_transformer

    def test_show_point_should_replace_controllers_transformer(self, *args):
        self.setup_mocks(args)
        self.mock_configuration_manager.load.return_value = self.default_config
        calibration_api = CalibrationAPI(self.mock_configuration_manager)

        calibration_api.show_test_pattern('Hilbert Space Filling Curve')
        calibration_api.show_point()

        self.mock_path_to_audio.set_transformer.assert_called_with(self.mock_tuning_transformer)
開發者ID:BenBlumer,項目名稱:peachyprintertools,代碼行數:9,代碼來源:calibration_api_test.py

示例10: test_show_scale_should_use_Square_Generator_and_Tuning_Transformer

    def test_show_scale_should_use_Square_Generator_and_Tuning_Transformer(self, mock_SquareGenerator, *args):
        self.setup_mocks(args)
        self.mock_configuration_manager.load.return_value = self.default_config
        calibration_api = CalibrationAPI(self.mock_configuration_manager)

        calibration_api.show_scale()

        self.mock_controller.change_generator.assert_called_with(self.mock_scale_generator)
        self.mock_path_to_audio.set_transformer.assert_called_with(self.mock_tuning_transformer)
開發者ID:BenBlumer,項目名稱:peachyprintertools,代碼行數:9,代碼來源:calibration_api_test.py

示例11: test_show_point_should_set_coordanates_on_Single_Point_Generator

    def test_show_point_should_set_coordanates_on_Single_Point_Generator(self, *args):
        self.setup_mocks(args)
        self.mock_configuration_manager.load.return_value = self.default_config
        calibration_api = CalibrationAPI(self.mock_configuration_manager)
        x, y, z = 1.0, 0.2, 1.0

        calibration_api.show_point([x, y, z])

        self.assertEquals([x, y], self.mock_single_point_generator.xy)
開發者ID:BenBlumer,項目名稱:peachyprintertools,代碼行數:9,代碼來源:calibration_api_test.py

示例12: test_set_laser_override

    def test_set_laser_override(self, *args):
        self.setup_mocks(args)
        self.mock_configuration_manager.load.return_value = self.default_config

        calibration_api = CalibrationAPI(self.mock_configuration_manager)

        calibration_api.set_laser_off_override(True)
        self.assertTrue(self.mock_controller.laser_off_override)
        calibration_api.set_laser_off_override(False)
        self.assertFalse(self.mock_controller.laser_off_override)
開發者ID:BenBlumer,項目名稱:peachyprintertools,代碼行數:10,代碼來源:calibration_api_test.py

示例13: test_get_max_deflection_should_return_max_deflection

    def test_get_max_deflection_should_return_max_deflection(self, *args):
        self.setup_mocks(args)
        config = self.default_config
        expected = 0.68
        config.calibration.max_deflection = expected
        self.mock_configuration_manager.load.return_value = config

        calibration_api = CalibrationAPI(self.mock_configuration_manager)

        actual = calibration_api.get_max_deflection()
        self.assertEquals(expected, actual)
開發者ID:BenBlumer,項目名稱:peachyprintertools,代碼行數:11,代碼來源:calibration_api_test.py

示例14: test_show_blink_should_use_blink_Generator

    def test_show_blink_should_use_blink_Generator(self, *args):
        self.setup_mocks(args)
        self.mock_configuration_manager.load.return_value = self.default_config

        calibration_api = CalibrationAPI(self.mock_configuration_manager)
        x, y, z = 1.0, 0.2, 1.0

        calibration_api.show_line()
        calibration_api.show_blink([x, y, z])

        self.mock_controller.change_generator.assert_called_with(self.mock_blink_generator)
開發者ID:BenBlumer,項目名稱:peachyprintertools,代碼行數:11,代碼來源:calibration_api_test.py

示例15: test_set_test_pattern_height_changes_height

    def test_set_test_pattern_height_changes_height(self, *args):
        self.setup_mocks(args)

        self.mock_configuration_manager.load.return_value = self.default_config

        calibration_api = CalibrationAPI(self.mock_configuration_manager)
        calibration_api.set_test_pattern_current_height(150.0)

        self.mock_hilbert_generator.set_current_height.assert_called_with(150.0)
        self.mock_square_generator.set_current_height.assert_called_with(150.0)
        self.mock_circle_generator.set_current_height.assert_called_with(150.0)
        self.mock_spiral_generator.set_current_height.assert_called_with(150.0)
        self.mock_memory_hourglass_generator.set_current_height.assert_called_with(150.0)
開發者ID:BenBlumer,項目名稱:peachyprintertools,代碼行數:13,代碼來源:calibration_api_test.py


注:本文中的peachyprinter.api.calibration_api.CalibrationAPI類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。