From bec75beb6a6f6083766f2f8827ef0e45200936bf Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Mon, 3 Jul 2023 20:50:33 -0400 Subject: [PATCH] Pass problematic tests (#83) That way, when we fix the bug, the tests will fail, in which case we will know that our fix is working. Also, we won't forget to uncomment the problematic tests. --- .../cast/python/ml/test/TestTensorflowModel.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflowModel.java b/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflowModel.java index 32d41cdf5..5d3c967ef 100644 --- a/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflowModel.java +++ b/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflowModel.java @@ -17,6 +17,7 @@ import java.io.IOException; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -105,8 +106,11 @@ public void testTf2() testTf2("tf2p2.py", "value_index", 2, 4, 2, 3); testTf2("tf2q.py", "add", 2, 3, 2, 3); testTf2("tf2r.py", "add", 2, 3, 2, 3); - // TODO: Uncomment below test when https://github.com/wala/ML/issues/65 is fixed. - // testTf2("tf2s.py", "add", 2, 3, 2, 3); + testTf2( + "tf2s.py", "add", 0, + 0); // NOTE: Set the expected number of tensor parameters, variables, and tensor parameter + // value numbers to 2, 3, and 2 and 3, respectively, when + // https://github.com/wala/ML/issues/65 is fixed. testTf2("tf2t.py", "add", 2, 3, 2, 3); testTf2("tf2u.py", "add", 2, 3, 2, 3); testTf2("tf2u2.py", "add", 2, 3, 2, 3); @@ -245,7 +249,8 @@ private void testTf2( final String functionSignature = "script " + filename + "." + functionName + ".do()LRoot;"; // get the pointer keys for the function. - Set functionPointerKeys = methodSignatureToPointerKeys.get(functionSignature); + Set functionPointerKeys = + methodSignatureToPointerKeys.getOrDefault(functionSignature, Collections.emptySet()); // check tensor parameters. assertEquals(expectedNumberOfTensorParameters, functionPointerKeys.size()); @@ -261,7 +266,8 @@ private void testTf2( .forEach(ev -> actualValueNumberSet.contains(ev)); // get the tensor variables for the function. - Set functionTensors = methodSignatureToTensorVariables.get(functionSignature); + Set functionTensors = + methodSignatureToTensorVariables.getOrDefault(functionSignature, Collections.emptySet()); // check tensor parameters. assertEquals(expectedNumberOfTensorParameters, functionTensors.size());