##// END OF EJS Templates
Remove Python 2 shim....
Matthias Bussonnier -
Show More
@@ -8,23 +8,21 b' artificially).'
8 """
8 """
9 from IPython.utils.py3compat import doctest_refactor_print
9 from IPython.utils.py3compat import doctest_refactor_print
10
10
11 @doctest_refactor_print
12 def doctest_simple():
11 def doctest_simple():
13 """ipdoctest must handle simple inputs
12 """ipdoctest must handle simple inputs
14
13
15 In [1]: 1
14 In [1]: 1
16 Out[1]: 1
15 Out[1]: 1
17
16
18 In [2]: print 1
17 In [2]: print(1)
19 1
18 1
20 """
19 """
21
20
22 @doctest_refactor_print
23 def doctest_multiline1():
21 def doctest_multiline1():
24 """The ipdoctest machinery must handle multiline examples gracefully.
22 """The ipdoctest machinery must handle multiline examples gracefully.
25
23
26 In [2]: for i in range(4):
24 In [2]: for i in range(4):
27 ...: print i
25 ...: print(i)
28 ...:
26 ...:
29 0
27 0
30 1
28 1
@@ -32,7 +30,6 b' def doctest_multiline1():'
32 3
30 3
33 """
31 """
34
32
35 @doctest_refactor_print
36 def doctest_multiline2():
33 def doctest_multiline2():
37 """Multiline examples that define functions and print output.
34 """Multiline examples that define functions and print output.
38
35
@@ -44,7 +41,7 b' def doctest_multiline2():'
44 Out[8]: 2
41 Out[8]: 2
45
42
46 In [9]: def g(x):
43 In [9]: def g(x):
47 ...: print 'x is:',x
44 ...: print('x is:',x)
48 ...:
45 ...:
49
46
50 In [10]: g(1)
47 In [10]: g(1)
@@ -193,14 +193,6 b' def _print_statement_sub(match):'
193 expr = match.groups('expr')
193 expr = match.groups('expr')
194 return "print(%s)" % expr
194 return "print(%s)" % expr
195
195
196 @_modify_str_or_docstring
197 def doctest_refactor_print(doc):
198 """Refactor 'print x' statements in a doctest to print(x) style. 2to3
199 unfortunately doesn't pick up on our doctests.
200
201 Can accept a string or a function, so it can be used as a decorator."""
202 return _print_statement_re.sub(_print_statement_sub, doc)
203
204 # Abstract u'abc' syntax:
196 # Abstract u'abc' syntax:
205 @_modify_str_or_docstring
197 @_modify_str_or_docstring
206 def u_format(s):
198 def u_format(s):
General Comments 0
You need to be logged in to leave comments. Login now