diff --git a/IPython/core/tests/test_magic_terminal.py b/IPython/core/tests/test_magic_terminal.py index 79e2d3e..3b53aad 100644 --- a/IPython/core/tests/test_magic_terminal.py +++ b/IPython/core/tests/test_magic_terminal.py @@ -11,8 +11,6 @@ import sys from io import StringIO from unittest import TestCase -import nose.tools as nt - from IPython.testing import tools as tt #----------------------------------------------------------------------------- @@ -93,16 +91,16 @@ class PasteTestCase(TestCase): ip.hooks.clipboard_get = self.original_clip def test_paste(self): - ip.user_ns.pop('x', None) - self.paste('x = 1') - nt.assert_equal(ip.user_ns['x'], 1) - ip.user_ns.pop('x') + ip.user_ns.pop("x", None) + self.paste("x = 1") + self.assertEqual(ip.user_ns["x"], 1) + ip.user_ns.pop("x") def test_paste_pyprompt(self): - ip.user_ns.pop('x', None) - self.paste('>>> x=2') - nt.assert_equal(ip.user_ns['x'], 2) - ip.user_ns.pop('x') + ip.user_ns.pop("x", None) + self.paste(">>> x=2") + self.assertEqual(ip.user_ns["x"], 2) + ip.user_ns.pop("x") def test_paste_py_multi(self): self.paste(""" @@ -111,35 +109,38 @@ class PasteTestCase(TestCase): >>> for i in x: ... y.append(i**2) ... - """) - nt.assert_equal(ip.user_ns['x'], [1,2,3]) - nt.assert_equal(ip.user_ns['y'], [1,4,9]) + """ + ) + self.assertEqual(ip.user_ns["x"], [1, 2, 3]) + self.assertEqual(ip.user_ns["y"], [1, 4, 9]) def test_paste_py_multi_r(self): "Now, test that self.paste -r works" self.test_paste_py_multi() - nt.assert_equal(ip.user_ns.pop('x'), [1,2,3]) - nt.assert_equal(ip.user_ns.pop('y'), [1,4,9]) - nt.assert_false('x' in ip.user_ns) - ip.magic('paste -r') - nt.assert_equal(ip.user_ns['x'], [1,2,3]) - nt.assert_equal(ip.user_ns['y'], [1,4,9]) + self.assertEqual(ip.user_ns.pop("x"), [1, 2, 3]) + self.assertEqual(ip.user_ns.pop("y"), [1, 4, 9]) + self.assertFalse("x" in ip.user_ns) + ip.magic("paste -r") + self.assertEqual(ip.user_ns["x"], [1, 2, 3]) + self.assertEqual(ip.user_ns["y"], [1, 4, 9]) def test_paste_email(self): "Test pasting of email-quoted contents" self.paste("""\ >> def foo(x): >> return x + 1 - >> xx = foo(1.1)""") - nt.assert_equal(ip.user_ns['xx'], 2.1) + >> xx = foo(1.1)""" + ) + self.assertEqual(ip.user_ns["xx"], 2.1) def test_paste_email2(self): "Email again; some programs add a space also at each quoting level" self.paste("""\ > > def foo(x): > > return x + 1 - > > yy = foo(2.1) """) - nt.assert_equal(ip.user_ns['yy'], 3.1) + > > yy = foo(2.1) """ + ) + self.assertEqual(ip.user_ns["yy"], 3.1) def test_paste_email_py(self): "Email quoting of interactive input" @@ -147,8 +148,9 @@ class PasteTestCase(TestCase): >> >>> def f(x): >> ... return x+1 >> ... - >> >>> zz = f(2.5) """) - nt.assert_equal(ip.user_ns['zz'], 3.5) + >> >>> zz = f(2.5) """ + ) + self.assertEqual(ip.user_ns["zz"], 3.5) def test_paste_echo(self): "Also test self.paste echoing, by temporarily faking the writer" @@ -163,9 +165,9 @@ class PasteTestCase(TestCase): out = w.getvalue() finally: ip.write = writer - nt.assert_equal(ip.user_ns['a'], 100) - nt.assert_equal(ip.user_ns['b'], 200) - assert out == code+"\n## -- End pasted text --\n" + self.assertEqual(ip.user_ns["a"], 100) + self.assertEqual(ip.user_ns["b"], 200) + assert out == code + "\n## -- End pasted text --\n" def test_paste_leading_commas(self): "Test multiline strings with leading commas" @@ -174,10 +176,9 @@ class PasteTestCase(TestCase): a = """ ,1,2,3 """''' - ip.user_ns.pop('foo', None) - tm.store_or_execute(s, 'foo') - nt.assert_in('foo', ip.user_ns) - + ip.user_ns.pop("foo", None) + tm.store_or_execute(s, "foo") + self.assertIn("foo", ip.user_ns) def test_paste_trailing_question(self): "Test pasting sources with trailing question marks" @@ -189,4 +190,4 @@ def funcfoo(): ''' ip.user_ns.pop('funcfoo', None) self.paste(s) - nt.assert_equal(ip.user_ns['funcfoo'](), 'fooresult') + self.assertEqual(ip.user_ns["funcfoo"](), "fooresult")