Skip to content

Commit 4633106

Browse files
committed
Add tests for wala#205.
1 parent 2f092cd commit 4633106

File tree

7 files changed

+74
-0
lines changed

7 files changed

+74
-0
lines changed

com.ibm.wala.cast.python.ml.test/source/com/ibm/wala/cast/python/ml/test/TestTensorflow2Model.java

+28
Original file line numberDiff line numberDiff line change
@@ -2802,6 +2802,34 @@ public void testModule67()
28022802
new int[] {3});
28032803
}
28042804

2805+
/** Test https://github.com/wala/ML/issues/205. */
2806+
@Test(expected = java.lang.AssertionError.class)
2807+
public void testModule68()
2808+
throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
2809+
test(
2810+
new String[] {"proj63/src/__init__.py", "proj63/src/module.py", "proj63/client.py"},
2811+
"src/module.py",
2812+
"f",
2813+
"proj63",
2814+
1,
2815+
1,
2816+
new int[] {2});
2817+
}
2818+
2819+
/** Test https://github.com/wala/ML/issues/205. */
2820+
@Test(expected = java.lang.IllegalStateException.class)
2821+
public void testModule69()
2822+
throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
2823+
test(
2824+
new String[] {"proj64/src/__init__.py", "proj64/src/module.py", "proj64/client.py"},
2825+
"src/module.py",
2826+
"f",
2827+
"proj64",
2828+
1,
2829+
1,
2830+
new int[] {2});
2831+
}
2832+
28052833
@Test
28062834
public void testStaticMethod() throws ClassHierarchyException, CancelException, IOException {
28072835
test("tf2_test_static_method.py", "MyClass.the_static_method", 1, 1, 2);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Test https://github.com/wala/ML/issues/163.
2+
3+
from tensorflow import ones
4+
from src import f
5+
6+
f(ones([1, 2]))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .module import f
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Test https://github.com/wala/ML/issues/163.
2+
3+
from tensorflow import Tensor
4+
from typing import NamedTuple, List
5+
import tensorflow as tf
6+
7+
8+
class GNNInput(NamedTuple):
9+
node_embeddings: tf.Tensor
10+
adjacency_lists: List
11+
edge_weights: List
12+
etan: tf.Tensor
13+
14+
15+
def f(a):
16+
assert isinstance(a, Tensor)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Test https://github.com/wala/ML/issues/163.
2+
3+
from tensorflow import ones
4+
from src import f
5+
6+
f(ones([1, 2]))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .module import *
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Test https://github.com/wala/ML/issues/163.
2+
3+
from tensorflow import Tensor
4+
from typing import NamedTuple, List
5+
import tensorflow as tf
6+
7+
8+
class GNNInput(NamedTuple):
9+
node_embeddings: tf.Tensor
10+
adjacency_lists: List
11+
edge_weights: List
12+
etan: tf.Tensor
13+
14+
15+
def f(a):
16+
assert isinstance(a, Tensor)

0 commit comments

Comments
 (0)