Skip to content

Commit

Permalink
Test wala#202.
Browse files Browse the repository at this point in the history
  • Loading branch information
khatchad committed Jul 11, 2024
1 parent a6c470a commit 91918d0
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2760,6 +2760,48 @@ public void testModule64()
new int[] {3});
}

/** Test https://github.com/wala/ML/issues/202. */
@Test
public void testModule65()
throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
test(
new String[] {"proj60/src/__init__.py", "proj60/src/module.py", "proj60/client.py"},
"src/module.py",
"f",
"proj60",
1,
1,
new int[] {2});
}

/** Test https://github.com/wala/ML/issues/202. */
@Test
public void testModule66()
throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
test(
new String[] {"proj61/src/__init__.py", "proj61/src/module.py", "proj61/client.py"},
"src/module.py",
"f",
"proj61",
1,
1,
new int[] {2});
}

/** Test https://github.com/wala/ML/issues/202. */
@Test
public void testModule67()
throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
test(
new String[] {"proj62/src/__init__.py", "proj62/src/B.py", "proj62/A.py"},
"src/B.py",
"C.__call__",
"proj62",
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
eclipse.preferences.version=1
encoding//data/proj61/src/module.py=utf-8
encoding//data/proj62/src/B.py=utf-8
encoding/<project>=UTF-8
encoding/data=UTF-8
encoding/source=UTF-8
6 changes: 6 additions & 0 deletions com.ibm.wala.cast.python.test/data/proj60/client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Test https://github.com/wala/ML/issues/163.

from tensorflow import ones
from src import f

f(ones([1, 2]))
1 change: 1 addition & 0 deletions com.ibm.wala.cast.python.test/data/proj60/src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .module import f
9 changes: 9 additions & 0 deletions com.ibm.wala.cast.python.test/data/proj60/src/module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""
@Author:Kaiyin Zhou
"""

from tensorflow import Tensor


def f(a):
assert isinstance(a, Tensor)
6 changes: 6 additions & 0 deletions com.ibm.wala.cast.python.test/data/proj61/client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Test https://github.com/wala/ML/issues/163.

from tensorflow import ones
from src import f

f(ones([1, 2]))
1 change: 1 addition & 0 deletions com.ibm.wala.cast.python.test/data/proj61/src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .module import *
10 changes: 10 additions & 0 deletions com.ibm.wala.cast.python.test/data/proj61/src/module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#! usr/bin/env python3
# -*- coding:utf-8 -*-
"""
@Author:Kaiyin Zhou
"""
from tensorflow import Tensor


def f(a):
assert isinstance(a, Tensor)
16 changes: 16 additions & 0 deletions com.ibm.wala.cast.python.test/data/proj62/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()()
15 changes: 15 additions & 0 deletions com.ibm.wala.cast.python.test/data/proj62/src/B.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#! usr/bin/env python3
# -*- coding:utf-8 -*-
"""
@Author:Kaiyin Zhou
"""
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/proj62/src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .B import *

0 comments on commit 91918d0

Please sign in to comment.