diff --git a/IPython/core/tests/test_autocall.py b/IPython/core/tests/test_autocall.py index b0cdada..a8a3761 100644 --- a/IPython/core/tests/test_autocall.py +++ b/IPython/core/tests/test_autocall.py @@ -14,7 +14,6 @@ from IPython.testing.globalipapp import get_ipython ip = get_ipython() -@py3compat.doctest_refactor_print def doctest_autocall(): """ In [1]: def f1(a,b,c): @@ -39,7 +38,7 @@ def doctest_autocall(): In [7]: assert _ == 'abc' - In [8]: print _ + In [8]: print(_) abc In [9]: /f1 1,2,3 diff --git a/IPython/core/tests/test_magic.py b/IPython/core/tests/test_magic.py index 5225ec3..4789d51 100644 --- a/IPython/core/tests/test_magic.py +++ b/IPython/core/tests/test_magic.py @@ -26,7 +26,6 @@ from IPython.core.magic import (Magics, magics_class, line_magic, from IPython.core.magics import execution, script, code, logging from IPython.testing import decorators as dec from IPython.testing import tools as tt -from IPython.utils import py3compat from IPython.utils.io import capture_output from IPython.utils.tempdir import TemporaryDirectory from IPython.utils.process import find_cmd @@ -304,12 +303,10 @@ def test_macro_run(): """Test that we can run a multi-line macro successfully.""" ip = get_ipython() ip.history_manager.reset() - cmds = ["a=10", "a+=1", py3compat.doctest_refactor_print("print a"), - "%macro test 2-3"] + cmds = ["a=10", "a+=1", "print(a)", "%macro test 2-3"] for cmd in cmds: ip.run_cell(cmd, store_history=True) - nt.assert_equal(ip.user_ns["test"].value, - py3compat.doctest_refactor_print("a+=1\nprint a\n")) + nt.assert_equal(ip.user_ns["test"].value, "a+=1\nprint(a)\n") with tt.AssertPrints("12"): ip.run_cell("test") with tt.AssertPrints("13"): @@ -532,7 +529,6 @@ def test_whos(): _ip.user_ns['a'] = A() _ip.magic("whos") -@py3compat.u_format def doctest_precision(): """doctest for %precision diff --git a/IPython/core/tests/test_profile.py b/IPython/core/tests/test_profile.py index 80599d2..021b31c 100644 --- a/IPython/core/tests/test_profile.py +++ b/IPython/core/tests/test_profile.py @@ -34,7 +34,6 @@ from IPython.core.profiledir import ProfileDir from IPython.testing import decorators as dec from IPython.testing import tools as tt -from IPython.utils import py3compat from IPython.utils.process import getoutput from IPython.utils.tempdir import TemporaryDirectory @@ -100,15 +99,14 @@ class ProfileStartupTest(TestCase): f.write(startup) # write simple test file, to check that the startup file was run with open(self.fname, 'w') as f: - f.write(py3compat.doctest_refactor_print(test)) + f.write(test) def validate(self, output): tt.ipexec_validate(self.fname, output, '', options=self.options) @dec.skipif(win32_without_pywin32(), "Test requires pywin32 on Windows") def test_startup_py(self): - self.init('00-start.py', 'zzz=123\n', - py3compat.doctest_refactor_print('print zzz\n')) + self.init('00-start.py', 'zzz=123\n', 'print(zzz)\n') self.validate('123') @dec.skipif(win32_without_pywin32(), "Test requires pywin32 on Windows") diff --git a/IPython/core/tests/test_run.py b/IPython/core/tests/test_run.py index f8ba6c7..2afa5ba 100644 --- a/IPython/core/tests/test_run.py +++ b/IPython/core/tests/test_run.py @@ -31,7 +31,6 @@ from nose import SkipTest from IPython.testing import decorators as dec from IPython.testing import tools as tt -from IPython.utils import py3compat from IPython.utils.io import capture_output from IPython.utils.tempdir import TemporaryDirectory from IPython.core import debugger @@ -145,13 +144,12 @@ def doctest_run_option_parser_for_windows(): """ -@py3compat.doctest_refactor_print def doctest_reset_del(): """Test that resetting doesn't cause errors in __del__ methods. In [2]: class A(object): ...: def __del__(self): - ...: print str("Hi") + ...: print(str("Hi")) ...: In [3]: a = A() @@ -248,9 +246,9 @@ class TestMagicRunSimple(tt.TempFileMixin): raise SkipTest("Test requires pywin32") src = ("class A(object):\n" " def __del__(self):\n" - " print 'object A deleted'\n" + " print('object A deleted')\n" "a = A()\n") - self.mktmp(py3compat.doctest_refactor_print(src)) + self.mktmp(src) if dec.module_not_available('sqlite3'): err = 'WARNING: IPython History requires SQLite, your history will not be saved\n' else: diff --git a/IPython/testing/tests/test_ipunittest.py b/IPython/testing/tests/test_ipunittest.py index 30610d5..df43654 100644 --- a/IPython/testing/tests/test_ipunittest.py +++ b/IPython/testing/tests/test_ipunittest.py @@ -46,29 +46,26 @@ Authors #----------------------------------------------------------------------------- from IPython.testing.ipunittest import ipdoctest, ipdocstring -from IPython.utils.py3compat import doctest_refactor_print #----------------------------------------------------------------------------- # Test classes and functions #----------------------------------------------------------------------------- @ipdoctest -@doctest_refactor_print def simple_dt(): """ - >>> print 1+1 + >>> print(1+1) 2 """ @ipdoctest -@doctest_refactor_print def ipdt_flush(): """ -In [20]: print 1 +In [20]: print(1) 1 In [26]: for i in range(4): - ....: print i + ....: print(i) ....: ....: 0 @@ -82,14 +79,13 @@ Out[27]: 7 @ipdoctest -@doctest_refactor_print def ipdt_indented_test(): """ - In [20]: print 1 + In [20]: print(1) 1 In [26]: for i in range(4): - ....: print i + ....: print(i) ....: ....: 0 @@ -110,14 +106,13 @@ class Foo(object): """ @ipdocstring - @doctest_refactor_print def ipdt_method(self): """ - In [20]: print 1 + In [20]: print(1) 1 In [26]: for i in range(4): - ....: print i + ....: print(i) ....: ....: 0 @@ -129,9 +124,8 @@ class Foo(object): Out[27]: 7 """ - @doctest_refactor_print def normaldt_method(self): """ - >>> print 1+1 + >>> print(1+1) 2 """ diff --git a/IPython/utils/frame.py b/IPython/utils/frame.py index 60cd642..1e5e536 100644 --- a/IPython/utils/frame.py +++ b/IPython/utils/frame.py @@ -21,7 +21,6 @@ from IPython.utils import py3compat # Code #----------------------------------------------------------------------------- -@py3compat.doctest_refactor_print def extract_vars(*names,**kw): """Extract a set of variables by name from another frame. diff --git a/IPython/utils/io.py b/IPython/utils/io.py index 72c880c..3a4582f 100644 --- a/IPython/utils/io.py +++ b/IPython/utils/io.py @@ -17,7 +17,6 @@ from warnings import warn from IPython.utils.decorators import undoc from .capture import CapturedIO, capture_output -from .py3compat import input @undoc class IOStream: diff --git a/IPython/utils/sysinfo.py b/IPython/utils/sysinfo.py index 3fd0c0b..7c29ed0 100644 --- a/IPython/utils/sysinfo.py +++ b/IPython/utils/sysinfo.py @@ -21,7 +21,7 @@ import sys import subprocess from IPython.core import release -from IPython.utils import py3compat, _sysinfo, encoding +from IPython.utils import _sysinfo, encoding #----------------------------------------------------------------------------- # Code @@ -98,7 +98,6 @@ def get_sys_info(): path = p.realpath(p.dirname(p.abspath(p.join(__file__, '..')))) return pkg_info(path) -@py3compat.doctest_refactor_print def sys_info(): """Return useful information about IPython and the system, as a string. @@ -106,7 +105,7 @@ def sys_info(): -------- :: - In [2]: print sys_info() + In [2]: print(sys_info()) {'commit_hash': '144fdae', # random 'commit_source': 'repository', 'ipython_path': '/home/fperez/usr/lib/python2.6/site-packages/IPython', diff --git a/IPython/utils/tests/test_io.py b/IPython/utils/tests/test_io.py index 0b528c7..1a29a19 100644 --- a/IPython/utils/tests/test_io.py +++ b/IPython/utils/tests/test_io.py @@ -18,7 +18,6 @@ import nose.tools as nt from IPython.testing.decorators import skipif, skip_win32 from IPython.utils.io import IOStream, Tee, capture_output -from IPython.utils.py3compat import doctest_refactor_print from IPython.utils.tempdir import TemporaryDirectory @@ -59,7 +58,7 @@ class TeeTestCase(unittest.TestCase): def test_io_init(): """Test that io.stdin/out/err exist at startup""" for name in ('stdin', 'stdout', 'stderr'): - cmd = doctest_refactor_print("from IPython.utils import io;print io.%s.__class__"%name) + cmd = "from IPython.utils import io;print(io.%s.__class__)"%name p = Popen([sys.executable, '-c', cmd], stdout=PIPE) p.wait()