当前位置: 首页>>代码示例>>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;未经允许,请勿转载。