Skip to content

Commit

Permalink
task challenge
Browse files Browse the repository at this point in the history
  • Loading branch information
janvanrijn committed May 29, 2018
1 parent 79ba8f0 commit a52f6c9
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion apiconnector/src/test/java/apiconnector/TestTaskFunctions.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.openml.apiconnector.xml.Task;
import org.openml.apiconnector.xml.TaskInputs;
import org.openml.apiconnector.xml.Tasks;
import org.openml.apiconnector.xml.UploadTask;
import org.openml.apiconnector.xml.TaskInputs.Input;

public class TestTaskFunctions {
Expand Down Expand Up @@ -160,9 +161,31 @@ public void testCreateTaskIllegalValues() throws Exception {
}
}

@Test
public void testCreateChallengeTask() throws Exception {
Input[] inputs = new Input[4];
inputs[0] = new Input("estimation_procedure", "18");
inputs[1] = new Input("source_data", "128");
inputs[2] = new Input("source_data_labeled", "129");
inputs[3] = new Input("target_feature", "class");

File taskFile = TestDataFunctionality.inputsToTaskFile(inputs, 6);

int uploadId = 0;
try {
UploadTask ut = client_write.taskUpload(taskFile);
uploadId = ut.getId();
} catch (ApiException e) {
uploadId = TaskInformation.getTaskIdsFromErrorMessage(e)[0];
throw e;
} finally {
client_write.taskDelete(uploadId);
}
}

@Test(expected = ApiException.class)
public void testCreateClassificationTaskNumericTarget() throws Exception {
Input[] inputs = new Input[4];
Input[] inputs = new Input[3];
inputs[0] = new Input("estimation_procedure", "1");
inputs[1] = new Input("source_data", "1");
inputs[2] = new Input("target_feature", "carbon");
Expand Down

0 comments on commit a52f6c9

Please sign in to comment.