Merged revisions 55007-55179 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
........
r55077 | guido.van.rossum | 2007-05-02 11:54:37 -0700 (Wed, 02 May 2007) | 2 lines
Use the new print syntax, at least.
........
r55142 | fred.drake | 2007-05-04 21:27:30 -0700 (Fri, 04 May 2007) | 1 line
remove old cruftiness
........
r55143 | fred.drake | 2007-05-04 21:52:16 -0700 (Fri, 04 May 2007) | 1 line
make this work with the new Python
........
r55162 | neal.norwitz | 2007-05-06 22:29:18 -0700 (Sun, 06 May 2007) | 1 line
Get asdl code gen working with Python 2.3. Should continue to work with 3.0
........
r55164 | neal.norwitz | 2007-05-07 00:00:38 -0700 (Mon, 07 May 2007) | 1 line
Verify checkins to p3yk (sic) branch go to 3000 list.
........
r55166 | neal.norwitz | 2007-05-07 00:12:35 -0700 (Mon, 07 May 2007) | 1 line
Fix this test so it runs again by importing warnings_test properly.
........
r55167 | neal.norwitz | 2007-05-07 01:03:22 -0700 (Mon, 07 May 2007) | 8 lines
So long xrange. range() now supports values that are outside
-sys.maxint to sys.maxint. floats raise a TypeError.
This has been sitting for a long time. It probably has some problems and
needs cleanup. Objects/rangeobject.c now uses 4-space indents since
it is almost completely new.
........
r55171 | guido.van.rossum | 2007-05-07 10:21:26 -0700 (Mon, 07 May 2007) | 4 lines
Fix two tests that were previously depending on significant spaces
at the end of a line (and before that on Python 2.x print behavior
that has no exact equivalent in 3.0).
........
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index 60079a6..3adb98c 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -34,8 +34,8 @@
>>> sc = SampleClass(3)
>>> for i in range(10):
... sc = sc.double()
- ... print(sc.get(), end=' ')
- 6 12 24 48 96 192 384 768 1536 3072
+ ... print(' ', sc.get(), sep='', end='')
+ 6 12 24 48 96 192 384 768 1536 3072
"""
def __init__(self, val):
"""
@@ -996,7 +996,7 @@
(0, 1)
An example from the docs:
- >>> print(range(20)) #doctest: +NORMALIZE_WHITESPACE
+ >>> print(list(range(20))) #doctest: +NORMALIZE_WHITESPACE
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
@@ -1004,7 +1004,7 @@
output to match any substring in the actual output:
>>> def f(x):
- ... '>>> print(range(15))\n[0, 1, 2, ..., 14]\n'
+ ... '>>> print(list(range(15)))\n[0, 1, 2, ..., 14]\n'
>>> # Without the flag:
>>> test = doctest.DocTestFinder().find(f)[0]
@@ -1013,7 +1013,7 @@
**********************************************************************
File ..., line 2, in f
Failed example:
- print(range(15))
+ print(list(range(15)))
Expected:
[0, 1, 2, ..., 14]
Got:
@@ -1044,10 +1044,10 @@
Examples from the docs:
- >>> print(range(20)) # doctest:+ELLIPSIS
+ >>> print(list(range(20))) # doctest:+ELLIPSIS
[0, 1, ..., 18, 19]
- >>> print(range(20)) # doctest: +ELLIPSIS
+ >>> print(list(range(20))) # doctest: +ELLIPSIS
... # doctest: +NORMALIZE_WHITESPACE
[0, 1, ..., 18, 19]
@@ -1302,10 +1302,10 @@
example with a comment of the form ``# doctest: +OPTION``:
>>> def f(x): r'''
- ... >>> print(range(10)) # should fail: no ellipsis
+ ... >>> print(list(range(10))) # should fail: no ellipsis
... [0, 1, ..., 9]
...
- ... >>> print(range(10)) # doctest: +ELLIPSIS
+ ... >>> print(list(range(10))) # doctest: +ELLIPSIS
... [0, 1, ..., 9]
... '''
>>> test = doctest.DocTestFinder().find(f)[0]
@@ -1314,7 +1314,7 @@
**********************************************************************
File ..., line 2, in f
Failed example:
- print(range(10)) # should fail: no ellipsis
+ print(list(range(10))) # should fail: no ellipsis
Expected:
[0, 1, ..., 9]
Got:
@@ -1325,11 +1325,11 @@
comment of the form ``# doctest: -OPTION``:
>>> def f(x): r'''
- ... >>> print(range(10))
+ ... >>> print(list(range(10)))
... [0, 1, ..., 9]
...
... >>> # should fail: no ellipsis
- ... >>> print(range(10)) # doctest: -ELLIPSIS
+ ... >>> print(list(range(10))) # doctest: -ELLIPSIS
... [0, 1, ..., 9]
... '''
>>> test = doctest.DocTestFinder().find(f)[0]
@@ -1339,7 +1339,7 @@
**********************************************************************
File ..., line 6, in f
Failed example:
- print(range(10)) # doctest: -ELLIPSIS
+ print(list(range(10))) # doctest: -ELLIPSIS
Expected:
[0, 1, ..., 9]
Got:
@@ -1350,13 +1350,13 @@
do not change the options for surrounding examples:
>>> def f(x): r'''
- ... >>> print(range(10)) # Should fail: no ellipsis
+ ... >>> print(list(range(10))) # Should fail: no ellipsis
... [0, 1, ..., 9]
...
- ... >>> print(range(10)) # doctest: +ELLIPSIS
+ ... >>> print(list(range(10))) # doctest: +ELLIPSIS
... [0, 1, ..., 9]
...
- ... >>> print(range(10)) # Should fail: no ellipsis
+ ... >>> print(list(range(10))) # Should fail: no ellipsis
... [0, 1, ..., 9]
... '''
>>> test = doctest.DocTestFinder().find(f)[0]
@@ -1365,7 +1365,7 @@
**********************************************************************
File ..., line 2, in f
Failed example:
- print(range(10)) # Should fail: no ellipsis
+ print(list(range(10))) # Should fail: no ellipsis
Expected:
[0, 1, ..., 9]
Got:
@@ -1373,7 +1373,7 @@
**********************************************************************
File ..., line 8, in f
Failed example:
- print(range(10)) # Should fail: no ellipsis
+ print(list(range(10))) # Should fail: no ellipsis
Expected:
[0, 1, ..., 9]
Got:
@@ -1384,9 +1384,9 @@
may be separated by whitespace, commas, or both:
>>> def f(x): r'''
- ... >>> print(range(10)) # Should fail
+ ... >>> print(list(range(10))) # Should fail
... [0, 1, ..., 9]
- ... >>> print(range(10)) # Should succeed
+ ... >>> print(list(range(10))) # Should succeed
... ... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
... [0, 1, ..., 9]
... '''
@@ -1396,7 +1396,7 @@
**********************************************************************
File ..., line 2, in f
Failed example:
- print(range(10)) # Should fail
+ print(list(range(10))) # Should fail
Expected:
[0, 1, ..., 9]
Got:
@@ -1404,9 +1404,9 @@
(1, 2)
>>> def f(x): r'''
- ... >>> print(range(10)) # Should fail
+ ... >>> print(list(range(10))) # Should fail
... [0, 1, ..., 9]
- ... >>> print(range(10)) # Should succeed
+ ... >>> print(list(range(10))) # Should succeed
... ... # doctest: +ELLIPSIS,+NORMALIZE_WHITESPACE
... [0, 1, ..., 9]
... '''
@@ -1416,7 +1416,7 @@
**********************************************************************
File ..., line 2, in f
Failed example:
- print(range(10)) # Should fail
+ print(list(range(10))) # Should fail
Expected:
[0, 1, ..., 9]
Got:
@@ -1424,9 +1424,9 @@
(1, 2)
>>> def f(x): r'''
- ... >>> print(range(10)) # Should fail
+ ... >>> print(list(range(10))) # Should fail
... [0, 1, ..., 9]
- ... >>> print(range(10)) # Should succeed
+ ... >>> print(list(range(10))) # Should succeed
... ... # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
... [0, 1, ..., 9]
... '''
@@ -1436,7 +1436,7 @@
**********************************************************************
File ..., line 2, in f
Failed example:
- print(range(10)) # Should fail
+ print(list(range(10))) # Should fail
Expected:
[0, 1, ..., 9]
Got:
@@ -1447,7 +1447,7 @@
long as a continuation prompt is used:
>>> def f(x): r'''
- ... >>> print(range(10))
+ ... >>> print(list(range(10)))
... ... # doctest: +ELLIPSIS
... [0, 1, ..., 9]
... '''
@@ -1460,12 +1460,12 @@
>>> def f(x): r'''
... >>> for x in range(10): # doctest: +ELLIPSIS
- ... ... print(x, end=' ')
- ... 0 1 2 ... 9
+ ... ... print(' ', x, end='', sep='')
+ ... 0 1 2 ... 9
...
... >>> for x in range(10):
- ... ... print(x, end=' ') # doctest: +ELLIPSIS
- ... 0 1 2 ... 9
+ ... ... print(' ', x, end='', sep='') # doctest: +ELLIPSIS
+ ... 0 1 2 ... 9
... '''
>>> test = doctest.DocTestFinder().find(f)[0]
>>> doctest.DocTestRunner(verbose=False).run(test)