Skip to content

Commit

Permalink
Add tests for wala#202.
Browse files Browse the repository at this point in the history
  • Loading branch information
khatchad committed Jul 10, 2024
1 parent 34334d7 commit ca435ec
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2732,6 +2732,34 @@ public void testModule62()
new int[] {3});
}

/** Test https://github.com/wala/ML/issues/202. */
@Test
public void testModule63()
throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
test(
new String[] {"proj58/src/__init__.py", "proj58/src/B.py", "proj58/A.py"},
"src/B.py",
"C.__call__",
"proj58",
1,
1,
new int[] {3});
}

/** Test https://github.com/wala/ML/issues/202. */
@Test
public void testModule64()
throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
test(
new String[] {"proj59/src/__init__.py", "proj59/src/B.py", "proj59/A.py"},
"src/B.py",
"C.__call__",
"proj59",
1,
1,
new int[] {3});
}

@Test
public void testStaticMethod() throws ClassHierarchyException, CancelException, IOException {
test("tf2_test_static_method.py", "MyClass.the_static_method", 1, 1, 2);
Expand Down
16 changes: 16 additions & 0 deletions com.ibm.wala.cast.python.test/data/proj58/A.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Test https://github.com/wala/ML/issues/163.

from tensorflow import ones
from src import C


class D:

def __init__(self):
self._c = C()

def __call__(self):
self._c(ones([1, 2]))


D()()
12 changes: 12 additions & 0 deletions com.ibm.wala.cast.python.test/data/proj58/src/B.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Test https://github.com/wala/ML/issues/163.

from tensorflow import Tensor


class C:

def __init__(self):
pass

def __call__(self, a):
assert isinstance(a, Tensor)
1 change: 1 addition & 0 deletions com.ibm.wala.cast.python.test/data/proj58/src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .B import C
16 changes: 16 additions & 0 deletions com.ibm.wala.cast.python.test/data/proj59/A.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Test https://github.com/wala/ML/issues/163.

from tensorflow import ones
from src import C


class D:

def __init__(self):
self._c = C()

def __call__(self):
self._c(ones([1, 2]))


D()()
12 changes: 12 additions & 0 deletions com.ibm.wala.cast.python.test/data/proj59/src/B.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Test https://github.com/wala/ML/issues/163.

from tensorflow import Tensor


class C:

def __init__(self):
pass

def __call__(self, a):
assert isinstance(a, Tensor)
1 change: 1 addition & 0 deletions com.ibm.wala.cast.python.test/data/proj59/src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .B import *

0 comments on commit ca435ec

Please sign in to comment.