diff --git a/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflow2Model.java b/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflow2Model.java index 2e58b906..749d3d2e 100644 --- a/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflow2Model.java +++ b/com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflow2Model.java @@ -2802,6 +2802,34 @@ public void testModule67() new int[] {3}); } + /** Test https://github.com/wala/ML/issues/205. */ + @Test(expected = java.lang.AssertionError.class) + public void testModule68() + throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException { + test( + new String[] {"proj63/src/__init__.py", "proj63/src/module.py", "proj63/client.py"}, + "src/module.py", + "f", + "proj63", + 1, + 1, + new int[] {2}); + } + + /** Test https://github.com/wala/ML/issues/205. */ + @Test(expected = java.lang.IllegalStateException.class) + public void testModule69() + throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException { + test( + new String[] {"proj64/src/__init__.py", "proj64/src/module.py", "proj64/client.py"}, + "src/module.py", + "f", + "proj64", + 1, + 1, + new int[] {2}); + } + @Test public void testStaticMethod() throws ClassHierarchyException, CancelException, IOException { test("tf2_test_static_method.py", "MyClass.the_static_method", 1, 1, 2); diff --git a/com.ibm.wala.cast.python.test/data/proj63/client.py b/com.ibm.wala.cast.python.test/data/proj63/client.py new file mode 100644 index 00000000..8590a685 --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/proj63/client.py @@ -0,0 +1,6 @@ +# Test https://github.com/wala/ML/issues/163. + +from tensorflow import ones +from src import f + +f(ones([1, 2])) diff --git a/com.ibm.wala.cast.python.test/data/proj63/src/__init__.py b/com.ibm.wala.cast.python.test/data/proj63/src/__init__.py new file mode 100644 index 00000000..9c32fb32 --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/proj63/src/__init__.py @@ -0,0 +1 @@ +from .module import f diff --git a/com.ibm.wala.cast.python.test/data/proj63/src/module.py b/com.ibm.wala.cast.python.test/data/proj63/src/module.py new file mode 100644 index 00000000..8e8f32df --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/proj63/src/module.py @@ -0,0 +1,16 @@ +# Test https://github.com/wala/ML/issues/163. + +from tensorflow import Tensor +from typing import NamedTuple, List +import tensorflow as tf + + +class GNNInput(NamedTuple): + node_embeddings: tf.Tensor + adjacency_lists: List + edge_weights: List + etan: tf.Tensor + + +def f(a): + assert isinstance(a, Tensor) diff --git a/com.ibm.wala.cast.python.test/data/proj64/client.py b/com.ibm.wala.cast.python.test/data/proj64/client.py new file mode 100644 index 00000000..8590a685 --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/proj64/client.py @@ -0,0 +1,6 @@ +# Test https://github.com/wala/ML/issues/163. + +from tensorflow import ones +from src import f + +f(ones([1, 2])) diff --git a/com.ibm.wala.cast.python.test/data/proj64/src/__init__.py b/com.ibm.wala.cast.python.test/data/proj64/src/__init__.py new file mode 100644 index 00000000..26769240 --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/proj64/src/__init__.py @@ -0,0 +1 @@ +from .module import * diff --git a/com.ibm.wala.cast.python.test/data/proj64/src/module.py b/com.ibm.wala.cast.python.test/data/proj64/src/module.py new file mode 100644 index 00000000..8e8f32df --- /dev/null +++ b/com.ibm.wala.cast.python.test/data/proj64/src/module.py @@ -0,0 +1,16 @@ +# Test https://github.com/wala/ML/issues/163. + +from tensorflow import Tensor +from typing import NamedTuple, List +import tensorflow as tf + + +class GNNInput(NamedTuple): + node_embeddings: tf.Tensor + adjacency_lists: List + edge_weights: List + etan: tf.Tensor + + +def f(a): + assert isinstance(a, Tensor)