Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3a9d061

Browse files
committed
Applying patch #100994 to allow JPython to use more of the standard
Python test suite. Specifically, - import time instead of strop in test_b1 - test for ClassType of exceptions using isinstance instead of equality in test_exceptions - remove __builtins__ from dir() output in test_pkg test_pkg output needs to be regenerated.
1 parent 736aa32 commit 3a9d061

4 files changed

Lines changed: 19 additions & 12 deletions

File tree

Lib/test/output/test_pkg

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ t5.foo loading
2626
t5.string loading
2727
1
2828
['foo', 'string', 't5']
29-
['__builtins__', '__doc__', '__file__', '__name__', '__path__', 'foo', 'string', 't5']
30-
['__builtins__', '__doc__', '__file__', '__name__', 'string']
31-
['__builtins__', '__doc__', '__file__', '__name__', 'spam']
29+
['__doc__', '__file__', '__name__', '__path__', 'foo', 'string', 't5']
30+
['__doc__', '__file__', '__name__', 'string']
31+
['__doc__', '__file__', '__name__', 'spam']
3232
running test t6
33-
['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__path__']
33+
['__all__', '__doc__', '__file__', '__name__', '__path__']
3434
t6.spam loading
3535
t6.ham loading
3636
t6.eggs loading
37-
['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__path__', 'eggs', 'ham', 'spam']
37+
['__all__', '__doc__', '__file__', '__name__', '__path__', 'eggs', 'ham', 'spam']
3838
['eggs', 'ham', 'spam', 't6']
3939
running test t7
4040
t7 loading

Lib/test/test_b1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
print '__import__'
66
__import__('sys')
7-
__import__('strop')
7+
__import__('time')
88
__import__('string')
99
try: __import__('spamspam')
1010
except ImportError: pass

Lib/test/test_exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_raise_catch(exc):
1919

2020
def r(thing):
2121
test_raise_catch(thing)
22-
if type(thing) == ClassType:
22+
if isinstance(thing, ClassType):
2323
print thing.__name__
2424
else:
2525
print thing

Lib/test/test_pkg.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ def rmdir(x):
4242
if verbose: print "rmdir", x
4343
os.rmdir(x)
4444

45+
def fixdir(lst):
46+
try:
47+
lst.remove('__builtins__')
48+
except ValueError:
49+
pass
50+
return lst
51+
4552
# Helper to run a test
4653

4754
def runtest(hier, code):
@@ -146,9 +153,9 @@ def runtest(hier, code):
146153
from t5 import *
147154
print dir()
148155
import t5
149-
print dir(t5)
150-
print dir(t5.foo)
151-
print dir(t5.string)
156+
print fixdir(dir(t5))
157+
print fixdir(dir(t5.foo))
158+
print fixdir(dir(t5.string))
152159
"""),
153160

154161
("t6", [
@@ -160,9 +167,9 @@ def runtest(hier, code):
160167
],
161168
"""
162169
import t6
163-
print dir(t6)
170+
print fixdir(dir(t6))
164171
from t6 import *
165-
print dir(t6)
172+
print fixdir(dir(t6))
166173
print dir()
167174
"""),
168175

0 commit comments

Comments
 (0)