##// END OF EJS Templates
remove some py3compat usage
Matthias Bussonnier -
Show More
@@ -14,7 +14,6 b' from IPython.testing.globalipapp import get_ipython'
14 14 ip = get_ipython()
15 15
16 16
17 @py3compat.doctest_refactor_print
18 17 def doctest_autocall():
19 18 """
20 19 In [1]: def f1(a,b,c):
@@ -39,7 +38,7 b' def doctest_autocall():'
39 38
40 39 In [7]: assert _ == 'abc'
41 40
42 In [8]: print _
41 In [8]: print(_)
43 42 abc
44 43
45 44 In [9]: /f1 1,2,3
@@ -26,7 +26,6 b' from IPython.core.magic import (Magics, magics_class, line_magic,'
26 26 from IPython.core.magics import execution, script, code, logging
27 27 from IPython.testing import decorators as dec
28 28 from IPython.testing import tools as tt
29 from IPython.utils import py3compat
30 29 from IPython.utils.io import capture_output
31 30 from IPython.utils.tempdir import TemporaryDirectory
32 31 from IPython.utils.process import find_cmd
@@ -304,12 +303,10 b' def test_macro_run():'
304 303 """Test that we can run a multi-line macro successfully."""
305 304 ip = get_ipython()
306 305 ip.history_manager.reset()
307 cmds = ["a=10", "a+=1", py3compat.doctest_refactor_print("print a"),
308 "%macro test 2-3"]
306 cmds = ["a=10", "a+=1", "print(a)", "%macro test 2-3"]
309 307 for cmd in cmds:
310 308 ip.run_cell(cmd, store_history=True)
311 nt.assert_equal(ip.user_ns["test"].value,
312 py3compat.doctest_refactor_print("a+=1\nprint a\n"))
309 nt.assert_equal(ip.user_ns["test"].value, "a+=1\nprint(a)\n")
313 310 with tt.AssertPrints("12"):
314 311 ip.run_cell("test")
315 312 with tt.AssertPrints("13"):
@@ -532,7 +529,6 b' def test_whos():'
532 529 _ip.user_ns['a'] = A()
533 530 _ip.magic("whos")
534 531
535 @py3compat.u_format
536 532 def doctest_precision():
537 533 """doctest for %precision
538 534
@@ -34,7 +34,6 b' from IPython.core.profiledir import ProfileDir'
34 34
35 35 from IPython.testing import decorators as dec
36 36 from IPython.testing import tools as tt
37 from IPython.utils import py3compat
38 37 from IPython.utils.process import getoutput
39 38 from IPython.utils.tempdir import TemporaryDirectory
40 39
@@ -100,15 +99,14 b' class ProfileStartupTest(TestCase):'
100 99 f.write(startup)
101 100 # write simple test file, to check that the startup file was run
102 101 with open(self.fname, 'w') as f:
103 f.write(py3compat.doctest_refactor_print(test))
102 f.write(test)
104 103
105 104 def validate(self, output):
106 105 tt.ipexec_validate(self.fname, output, '', options=self.options)
107 106
108 107 @dec.skipif(win32_without_pywin32(), "Test requires pywin32 on Windows")
109 108 def test_startup_py(self):
110 self.init('00-start.py', 'zzz=123\n',
111 py3compat.doctest_refactor_print('print zzz\n'))
109 self.init('00-start.py', 'zzz=123\n', 'print(zzz)\n')
112 110 self.validate('123')
113 111
114 112 @dec.skipif(win32_without_pywin32(), "Test requires pywin32 on Windows")
@@ -31,7 +31,6 b' from nose import SkipTest'
31 31
32 32 from IPython.testing import decorators as dec
33 33 from IPython.testing import tools as tt
34 from IPython.utils import py3compat
35 34 from IPython.utils.io import capture_output
36 35 from IPython.utils.tempdir import TemporaryDirectory
37 36 from IPython.core import debugger
@@ -145,13 +144,12 b' def doctest_run_option_parser_for_windows():'
145 144 """
146 145
147 146
148 @py3compat.doctest_refactor_print
149 147 def doctest_reset_del():
150 148 """Test that resetting doesn't cause errors in __del__ methods.
151 149
152 150 In [2]: class A(object):
153 151 ...: def __del__(self):
154 ...: print str("Hi")
152 ...: print(str("Hi"))
155 153 ...:
156 154
157 155 In [3]: a = A()
@@ -248,9 +246,9 b' class TestMagicRunSimple(tt.TempFileMixin):'
248 246 raise SkipTest("Test requires pywin32")
249 247 src = ("class A(object):\n"
250 248 " def __del__(self):\n"
251 " print 'object A deleted'\n"
249 " print('object A deleted')\n"
252 250 "a = A()\n")
253 self.mktmp(py3compat.doctest_refactor_print(src))
251 self.mktmp(src)
254 252 if dec.module_not_available('sqlite3'):
255 253 err = 'WARNING: IPython History requires SQLite, your history will not be saved\n'
256 254 else:
@@ -46,29 +46,26 b' Authors'
46 46 #-----------------------------------------------------------------------------
47 47
48 48 from IPython.testing.ipunittest import ipdoctest, ipdocstring
49 from IPython.utils.py3compat import doctest_refactor_print
50 49
51 50 #-----------------------------------------------------------------------------
52 51 # Test classes and functions
53 52 #-----------------------------------------------------------------------------
54 53 @ipdoctest
55 @doctest_refactor_print
56 54 def simple_dt():
57 55 """
58 >>> print 1+1
56 >>> print(1+1)
59 57 2
60 58 """
61 59
62 60
63 61 @ipdoctest
64 @doctest_refactor_print
65 62 def ipdt_flush():
66 63 """
67 In [20]: print 1
64 In [20]: print(1)
68 65 1
69 66
70 67 In [26]: for i in range(4):
71 ....: print i
68 ....: print(i)
72 69 ....:
73 70 ....:
74 71 0
@@ -82,14 +79,13 b' Out[27]: 7'
82 79
83 80
84 81 @ipdoctest
85 @doctest_refactor_print
86 82 def ipdt_indented_test():
87 83 """
88 In [20]: print 1
84 In [20]: print(1)
89 85 1
90 86
91 87 In [26]: for i in range(4):
92 ....: print i
88 ....: print(i)
93 89 ....:
94 90 ....:
95 91 0
@@ -110,14 +106,13 b' class Foo(object):'
110 106 """
111 107
112 108 @ipdocstring
113 @doctest_refactor_print
114 109 def ipdt_method(self):
115 110 """
116 In [20]: print 1
111 In [20]: print(1)
117 112 1
118 113
119 114 In [26]: for i in range(4):
120 ....: print i
115 ....: print(i)
121 116 ....:
122 117 ....:
123 118 0
@@ -129,9 +124,8 b' class Foo(object):'
129 124 Out[27]: 7
130 125 """
131 126
132 @doctest_refactor_print
133 127 def normaldt_method(self):
134 128 """
135 >>> print 1+1
129 >>> print(1+1)
136 130 2
137 131 """
@@ -21,7 +21,6 b' from IPython.utils import py3compat'
21 21 # Code
22 22 #-----------------------------------------------------------------------------
23 23
24 @py3compat.doctest_refactor_print
25 24 def extract_vars(*names,**kw):
26 25 """Extract a set of variables by name from another frame.
27 26
@@ -17,7 +17,6 b' from warnings import warn'
17 17
18 18 from IPython.utils.decorators import undoc
19 19 from .capture import CapturedIO, capture_output
20 from .py3compat import input
21 20
22 21 @undoc
23 22 class IOStream:
@@ -21,7 +21,7 b' import sys'
21 21 import subprocess
22 22
23 23 from IPython.core import release
24 from IPython.utils import py3compat, _sysinfo, encoding
24 from IPython.utils import _sysinfo, encoding
25 25
26 26 #-----------------------------------------------------------------------------
27 27 # Code
@@ -98,7 +98,6 b' def get_sys_info():'
98 98 path = p.realpath(p.dirname(p.abspath(p.join(__file__, '..'))))
99 99 return pkg_info(path)
100 100
101 @py3compat.doctest_refactor_print
102 101 def sys_info():
103 102 """Return useful information about IPython and the system, as a string.
104 103
@@ -106,7 +105,7 b' def sys_info():'
106 105 --------
107 106 ::
108 107
109 In [2]: print sys_info()
108 In [2]: print(sys_info())
110 109 {'commit_hash': '144fdae', # random
111 110 'commit_source': 'repository',
112 111 'ipython_path': '/home/fperez/usr/lib/python2.6/site-packages/IPython',
@@ -18,7 +18,6 b' import nose.tools as nt'
18 18
19 19 from IPython.testing.decorators import skipif, skip_win32
20 20 from IPython.utils.io import IOStream, Tee, capture_output
21 from IPython.utils.py3compat import doctest_refactor_print
22 21 from IPython.utils.tempdir import TemporaryDirectory
23 22
24 23
@@ -59,7 +58,7 b' class TeeTestCase(unittest.TestCase):'
59 58 def test_io_init():
60 59 """Test that io.stdin/out/err exist at startup"""
61 60 for name in ('stdin', 'stdout', 'stderr'):
62 cmd = doctest_refactor_print("from IPython.utils import io;print io.%s.__class__"%name)
61 cmd = "from IPython.utils import io;print(io.%s.__class__)"%name
63 62 p = Popen([sys.executable, '-c', cmd],
64 63 stdout=PIPE)
65 64 p.wait()
General Comments 0
You need to be logged in to leave comments. Login now