forked from jython/jython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test support classes for the last commit
- Loading branch information
Showing
10 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.python.tests.mro; | ||
|
||
/** | ||
* If {@link GetitemAdder#addPredefined} is called, this class is imported, then | ||
* {@link GetitemAdder#addPostdefined} is called, the call to postdefined should raise a TypeError | ||
* as this class produces a MRO conflict between {@link FirstPredefinedGetitem} and | ||
* {@link PostdefinedGetitem}. | ||
*/ | ||
public interface ConfusedOnGetitemAdd extends FirstAndPost, PostAndFirst {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.python.tests.mro; | ||
|
||
/** | ||
* {@link GetitemAdder#addPredefined} is expected to be called before this class is imported. If | ||
* that's happened, there's a MRO conflict between {@link FirstPredefinedGetitem} and | ||
* {@link SecondPredefinedGetitem}, so importing this should cause a TypeError. | ||
*/ | ||
public class ConfusedOnImport implements FirstAndSecond, SecondAndFirst {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package org.python.tests.mro; | ||
|
||
public interface FirstAndPost extends FirstPredefinedGetitem, PostdefinedGetitem {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package org.python.tests.mro; | ||
|
||
public interface FirstAndSecond extends FirstPredefinedGetitem, SecondPredefinedGetitem {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package org.python.tests.mro; | ||
|
||
public interface FirstPredefinedGetitem {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.python.tests.mro; | ||
|
||
import org.python.core.PyBuiltinMethod; | ||
import org.python.core.PyBuiltinMethodNarrow; | ||
import org.python.core.PyObject; | ||
import org.python.core.PyType; | ||
|
||
public class GetitemAdder { | ||
|
||
public static void addPostdefined() { | ||
PyBuiltinMethod meth = new PyBuiltinMethodNarrow("__getitem__", 1) { | ||
|
||
@Override | ||
public PyObject __call__(PyObject arg) { | ||
return arg; | ||
} | ||
}; | ||
PyType.fromClass(PostdefinedGetitem.class).addMethod(meth); | ||
} | ||
|
||
public static void addPredefined() { | ||
PyBuiltinMethod meth = new PyBuiltinMethodNarrow("__getitem__", 1) { | ||
|
||
@Override | ||
public PyObject __call__(PyObject arg) { | ||
return arg; | ||
} | ||
}; | ||
PyType.fromClass(FirstPredefinedGetitem.class).addMethod(meth); | ||
PyType.fromClass(SecondPredefinedGetitem.class).addMethod(meth); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package org.python.tests.mro; | ||
|
||
public interface PostAndFirst extends PostdefinedGetitem, FirstPredefinedGetitem {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package org.python.tests.mro; | ||
|
||
public interface PostdefinedGetitem {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package org.python.tests.mro; | ||
|
||
|
||
public interface SecondAndFirst extends SecondPredefinedGetitem, FirstPredefinedGetitem {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package org.python.tests.mro; | ||
|
||
|
||
public interface SecondPredefinedGetitem {} |