Skip to content

Commit

Permalink
PYTHONPATH only supported in Jython 3.
Browse files Browse the repository at this point in the history
Adjust tests to account for wala#147.
  • Loading branch information
khatchad committed Jul 24, 2024
1 parent bfd32fe commit d4d892e
Showing 1 changed file with 44 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3353,6 +3353,22 @@ public void testModule53()
@Test
public void testModule79()
throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
int expectNumberofTensorParameters;
int expectedNumberOfTensorVariables;
int[] expectedTensorParameterValueNumbers;

// PYTHONPATH is only supported for Jython3.
if (usesJython3Testing()) {
expectNumberofTensorParameters = 1;
expectedNumberOfTensorVariables = 1;
expectedTensorParameterValueNumbers = new int[] {2};
} else {
// NOTE: Remove this case once https://github.com/wala/ML/issues/147 is fixed.
expectNumberofTensorParameters = 0;
expectedNumberOfTensorVariables = 0;
expectedTensorParameterValueNumbers = new int[] {};
}

test(
new String[] {
"proj73/models/__init__.py",
Expand All @@ -3364,9 +3380,9 @@ public void testModule79()
"models/albert.py",
"f",
"proj73",
1,
1,
new int[] {2});
expectNumberofTensorParameters,
expectedNumberOfTensorVariables,
expectedTensorParameterValueNumbers);

test(
new String[] {
Expand All @@ -3379,15 +3395,31 @@ public void testModule79()
"models/bert.py",
"g",
"proj73",
1,
1,
new int[] {2});
expectNumberofTensorParameters,
expectedNumberOfTensorVariables,
expectedTensorParameterValueNumbers);
}

/** Test https://github.com/wala/ML/issues/209. */
@Test
public void testModule80()
throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
int expectNumberofTensorParameters;
int expectedNumberOfTensorVariables;
int[] expectedTensorParameterValueNumbers;

// PYTHONPATH is only supported for Jython3.
if (usesJython3Testing()) {
expectNumberofTensorParameters = 1;
expectedNumberOfTensorVariables = 1;
expectedTensorParameterValueNumbers = new int[] {2};
} else {
// NOTE: Remove this case once https://github.com/wala/ML/issues/147 is fixed.
expectNumberofTensorParameters = 0;
expectedNumberOfTensorVariables = 0;
expectedTensorParameterValueNumbers = new int[] {};
}

test(
new String[] {
"proj74/models/__init__.py",
Expand All @@ -3399,9 +3431,9 @@ public void testModule80()
"models/albert.py",
"f",
"proj74",
1,
1,
new int[] {2});
expectNumberofTensorParameters,
expectedNumberOfTensorVariables,
expectedTensorParameterValueNumbers);

test(
new String[] {
Expand All @@ -3414,9 +3446,9 @@ public void testModule80()
"models/bert.py",
"g",
"proj74",
1,
1,
new int[] {2});
expectNumberofTensorParameters,
expectedNumberOfTensorVariables,
expectedTensorParameterValueNumbers);
}

@Test
Expand Down

0 comments on commit d4d892e

Please sign in to comment.