本文整理汇总了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)
示例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")
示例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)
示例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)
示例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))
示例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()
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)