def test_check_should_use_scale(self, mock_GCodeToLayerGenerator): line = "Fake Gcode" test_gcode = StringIO.StringIO("%s\n" % line) gcode_reader = GCodeReader(test_gcode, scale=0.1) gcode_reader.check() mock_GCodeToLayerGenerator.assert_called_with(test_gcode, scale=0.1, start_height=None)
def test_check_should_use_scale(self, mock_GCodeToLayerGenerator): line = "Fake Gcode" test_gcode = StringIO.StringIO("%s\n" % line) gcode_reader = GCodeReader(test_gcode, scale=0.1) gcode_reader.check() mock_GCodeToLayerGenerator.assert_called_with(test_gcode, scale=0.1, start_height=None)
def test_check_should_report_error_on_non_gcode(self, mock_GCodeCommandReader): line = "Fake Gcode" mock_gcode_command_reader = mock_GCodeCommandReader.return_value expected_exception = Exception('Unreconized Command: %s' % (line)) mock_gcode_command_reader.to_command.side_effect = expected_exception test_gcode = StringIO.StringIO("%s\n" % line) gcode_reader = GCodeReader(test_gcode) errors = gcode_reader.check() self.assertEquals(["Error 1: Unreconized Command: %s" % line], errors)
def test_check_should_report_error_on_non_gcode(self, mock_GCodeCommandReader): line = "Fake Gcode" mock_gcode_command_reader = mock_GCodeCommandReader.return_value expected_exception = Exception('Unreconized Command: %s' % (line)) mock_gcode_command_reader.to_command.side_effect = expected_exception test_gcode = StringIO.StringIO("%s\n" % line) gcode_reader = GCodeReader(test_gcode) errors = gcode_reader.check() self.assertEquals(["Error 1: Unreconized Command: %s" % line], errors)