Skip to content

Commit 7a2601d

Browse files
e-straussmboehm7
authored andcommitted
[SYSTEMDS-3842] Improve test coverage of API components: MLContext
Closes #2262.
1 parent 692dcc3 commit 7a2601d

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

.github/workflows/python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ jobs:
118118
black \
119119
opt-einsum \
120120
nltk
121-
121+
122122
- name: Build Python Package
123123
run: |
124124
cd src/main/python

src/test/java/org/apache/sysds/test/functions/mlcontext/MLContextTest.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import org.apache.spark.sql.types.DoubleType;
5858
import org.apache.spark.sql.types.StructField;
5959
import org.apache.spark.sql.types.StructType;
60+
import org.apache.sysds.api.mlcontext.MLContext;
6061
import org.apache.sysds.api.mlcontext.MLContextConversionUtil;
6162
import org.apache.sysds.api.mlcontext.MLContextException;
6263
import org.apache.sysds.api.mlcontext.MLContextUtil;
@@ -1964,4 +1965,28 @@ public void testNNImport() {
19641965
.getScalarObject("R").getDoubleValue();
19651966
Assert.assertEquals(1000, ret, 1e-20);
19661967
}
1968+
1969+
@Test
1970+
public void testMLContextExecuteWithExplainType() {
1971+
LOG.debug("MLContextTest - test getter / setter");
1972+
ml.setExplain(true);
1973+
String s = "print(\"Hello World!\")";
1974+
for (MLContext.ExplainLevel el : MLContext.ExplainLevel.values()) {
1975+
ml.setExplainLevel(el);
1976+
String out = executeAndCaptureStdOut(dml(s)).getRight();
1977+
String[] lines = out.split("\n");
1978+
Assert.assertTrue(lines[0].contains(el.getExplainType().toString()));
1979+
}
1980+
}
1981+
1982+
@Test
1983+
public void testMLContextExecuteWithExecutionType() {
1984+
LOG.debug("MLContextTest - test getter / setter");
1985+
ml.setExplain(false);
1986+
String s = "print(\"Hello World!\")";
1987+
for (MLContext.ExecutionType et : MLContext.ExecutionType.values()) {
1988+
ml.setExecutionType(et);
1989+
ml.execute(dml(s));
1990+
}
1991+
}
19671992
}

0 commit comments

Comments
 (0)