From 2549896bf46e4c50652604679eaff690a2e60c17 2012-07-17 15:30:53 From: Bradley M. Froehle Date: 2012-07-17 15:30:53 Subject: [PATCH] s/nt.assert_equals/nt.assert_equal/ --- diff --git a/IPython/core/tests/test_completer.py b/IPython/core/tests/test_completer.py index c2aa49a..8ed8b2f 100644 --- a/IPython/core/tests/test_completer.py +++ b/IPython/core/tests/test_completer.py @@ -52,7 +52,7 @@ def test_protect_filename(): # run the actual tests for s1, s2 in pairs: s1p = completer.protect_filename(s1) - nt.assert_equals(s1p, s2) + nt.assert_equal(s1p, s2) def check_line_split(splitter, test_specs): diff --git a/IPython/core/tests/test_debugger.py b/IPython/core/tests/test_debugger.py index e1c5483..8e8a536 100644 --- a/IPython/core/tests/test_debugger.py +++ b/IPython/core/tests/test_debugger.py @@ -28,8 +28,8 @@ def test_longer_repr(): a = '1234567890'* 7 ar = "'1234567890123456789012345678901234567890123456789012345678901234567890'" a_trunc = "'123456789012...8901234567890'" - nt.assert_equals(trepr(a), a_trunc) + nt.assert_equal(trepr(a), a_trunc) # The creation of our tracer modifies the repr module's repr function # in-place, since that global is used directly by the stdlib's pdb module. t = debugger.Tracer() - nt.assert_equals(trepr(a), ar) + nt.assert_equal(trepr(a), ar) diff --git a/IPython/core/tests/test_formatters.py b/IPython/core/tests/test_formatters.py index 5e7e0c4..662645e 100644 --- a/IPython/core/tests/test_formatters.py +++ b/IPython/core/tests/test_formatters.py @@ -36,16 +36,16 @@ def foo_printer(obj, pp, cycle): def test_pretty(): f = PlainTextFormatter() f.for_type(A, foo_printer) - nt.assert_equals(f(A()), 'foo') - nt.assert_equals(f(B()), 'foo') - nt.assert_equals(f(GoodPretty()), 'foo') + nt.assert_equal(f(A()), 'foo') + nt.assert_equal(f(B()), 'foo') + nt.assert_equal(f(GoodPretty()), 'foo') # Just don't raise an exception for the following: f(BadPretty()) f.pprint = False - nt.assert_equals(f(A()), 'A()') - nt.assert_equals(f(B()), 'B()') - nt.assert_equals(f(GoodPretty()), 'GoodPretty()') + nt.assert_equal(f(A()), 'A()') + nt.assert_equal(f(B()), 'B()') + nt.assert_equal(f(GoodPretty()), 'GoodPretty()') def test_deferred(): @@ -54,29 +54,29 @@ def test_deferred(): def test_precision(): """test various values for float_precision.""" f = PlainTextFormatter() - nt.assert_equals(f(pi), repr(pi)) + nt.assert_equal(f(pi), repr(pi)) f.float_precision = 0 if numpy: po = numpy.get_printoptions() - nt.assert_equals(po['precision'], 0) - nt.assert_equals(f(pi), '3') + nt.assert_equal(po['precision'], 0) + nt.assert_equal(f(pi), '3') f.float_precision = 2 if numpy: po = numpy.get_printoptions() - nt.assert_equals(po['precision'], 2) - nt.assert_equals(f(pi), '3.14') + nt.assert_equal(po['precision'], 2) + nt.assert_equal(f(pi), '3.14') f.float_precision = '%g' if numpy: po = numpy.get_printoptions() - nt.assert_equals(po['precision'], 2) - nt.assert_equals(f(pi), '3.14159') + nt.assert_equal(po['precision'], 2) + nt.assert_equal(f(pi), '3.14159') f.float_precision = '%e' - nt.assert_equals(f(pi), '3.141593e+00') + nt.assert_equal(f(pi), '3.141593e+00') f.float_precision = '' if numpy: po = numpy.get_printoptions() - nt.assert_equals(po['precision'], 8) - nt.assert_equals(f(pi), repr(pi)) + nt.assert_equal(po['precision'], 8) + nt.assert_equal(f(pi), repr(pi)) def test_bad_precision(): """test various invalid values for float_precision.""" diff --git a/IPython/core/tests/test_handlers.py b/IPython/core/tests/test_handlers.py index 099abd9..683f224 100644 --- a/IPython/core/tests/test_handlers.py +++ b/IPython/core/tests/test_handlers.py @@ -166,4 +166,4 @@ def test_handlers(): ]) ip.magic('autocall 1') - nt.assert_equals(failures, []) + nt.assert_equal(failures, []) diff --git a/IPython/core/tests/test_history.py b/IPython/core/tests/test_history.py index 6b5c218..a7e7425 100644 --- a/IPython/core/tests/test_history.py +++ b/IPython/core/tests/test_history.py @@ -139,7 +139,7 @@ def test_hist_file_config(): cfg.HistoryManager.hist_file = tfile.name try: hm = HistoryManager(shell=get_ipython(), config=cfg) - nt.assert_equals(hm.hist_file, cfg.HistoryManager.hist_file) + nt.assert_equal(hm.hist_file, cfg.HistoryManager.hist_file) finally: try: os.remove(tfile.name) diff --git a/IPython/core/tests/test_inputsplitter.py b/IPython/core/tests/test_inputsplitter.py index 94f761e..a013d32 100644 --- a/IPython/core/tests/test_inputsplitter.py +++ b/IPython/core/tests/test_inputsplitter.py @@ -425,13 +425,13 @@ class InteractiveLoopTestCase(unittest.TestCase): def test_LineInfo(): """Simple test for LineInfo construction and str()""" linfo = isp.LineInfo(' %cd /home') - nt.assert_equals(str(linfo), 'LineInfo [ |%|cd|/home]') + nt.assert_equal(str(linfo), 'LineInfo [ |%|cd|/home]') # Transformer tests def transform_checker(tests, func): """Utility to loop over test inputs""" for inp, tr in tests: - nt.assert_equals(func(inp), tr) + nt.assert_equal(func(inp), tr) # Data for all the syntax tests in the form of lists of pairs of # raw/transformed input. We store it here as a global dict so that we can use diff --git a/IPython/core/tests/test_iplib.py b/IPython/core/tests/test_iplib.py index cbfe78c..6b2cb7e 100644 --- a/IPython/core/tests/test_iplib.py +++ b/IPython/core/tests/test_iplib.py @@ -45,8 +45,8 @@ def test_reset(): # Finally, check that all namespaces have only as many variables as we # expect to find in them: - nt.assert_equals(len(ip.user_ns), nvars_user_ns) - nt.assert_equals(len(ip.user_ns_hidden), nvars_hidden) + nt.assert_equal(len(ip.user_ns), nvars_user_ns) + nt.assert_equal(len(ip.user_ns_hidden), nvars_hidden) # Tests for reporting of exceptions in various modes, handling of SystemExit, @@ -231,7 +231,7 @@ def test_run_cell(): ip.run_cell('a = 10\na+=1') ip.run_cell('assert a == 11\nassert 1') - nt.assert_equals(ip.user_ns['a'], 11) + nt.assert_equal(ip.user_ns['a'], 11) complex = textwrap.dedent(""" if 1: print "hello" @@ -255,6 +255,6 @@ def test_run_cell(): def test_db(): """Test the internal database used for variable persistence.""" ip.db['__unittest_'] = 12 - nt.assert_equals(ip.db['__unittest_'], 12) + nt.assert_equal(ip.db['__unittest_'], 12) del ip.db['__unittest_'] assert '__unittest_' not in ip.db diff --git a/IPython/core/tests/test_magic.py b/IPython/core/tests/test_magic.py index 16b0ec6..33ebd9d 100644 --- a/IPython/core/tests/test_magic.py +++ b/IPython/core/tests/test_magic.py @@ -74,7 +74,7 @@ def test_magic_parse_options(): expected = 'c:x' else: expected = path - nt.assert_equals(opts['f'], expected) + nt.assert_equal(opts['f'], expected) def test_magic_parse_long_options(): """Magic.parse_options can handle --foo=bar long options""" @@ -280,7 +280,7 @@ def test_tb_syntaxerror(): sys.stdout = save_stdout # trim output, and only check the last line last_line = out.rstrip().splitlines()[-1].strip() - nt.assert_equals(last_line, "SyntaxError: invalid syntax") + nt.assert_equal(last_line, "SyntaxError: invalid syntax") @py3compat.doctest_refactor_print @@ -532,10 +532,10 @@ class CellMagicTestCase(TestCase): def check_ident(self, magic): # Manually called, we get the result out = _ip.run_cell_magic(magic, 'a', 'b') - nt.assert_equals(out, ('a','b')) + nt.assert_equal(out, ('a','b')) # Via run_cell, it goes into the user's namespace via displayhook _ip.run_cell('%%' + magic +' c\nd') - nt.assert_equals(_ip.user_ns['_'], ('c','d')) + nt.assert_equal(_ip.user_ns['_'], ('c','d')) def test_cell_magic_func_deco(self): "Cell magic using simple decorator" @@ -578,7 +578,7 @@ class CellMagicTestCase(TestCase): self.check_ident('cellm4') # Check that nothing is registered as 'cellm33' c33 = _ip.find_cell_magic('cellm33') - nt.assert_equals(c33, None) + nt.assert_equal(c33, None) def test_file(): """Basic %%file""" @@ -637,39 +637,39 @@ def test_script_config(): def test_script_out(): ip = get_ipython() ip.run_cell_magic("script", "--out output sh", "echo 'hi'") - nt.assert_equals(ip.user_ns['output'], 'hi\n') + nt.assert_equal(ip.user_ns['output'], 'hi\n') @dec.skip_win32 def test_script_err(): ip = get_ipython() ip.run_cell_magic("script", "--err error sh", "echo 'hello' >&2") - nt.assert_equals(ip.user_ns['error'], 'hello\n') + nt.assert_equal(ip.user_ns['error'], 'hello\n') @dec.skip_win32 def test_script_out_err(): ip = get_ipython() ip.run_cell_magic("script", "--out output --err error sh", "echo 'hi'\necho 'hello' >&2") - nt.assert_equals(ip.user_ns['output'], 'hi\n') - nt.assert_equals(ip.user_ns['error'], 'hello\n') + nt.assert_equal(ip.user_ns['output'], 'hi\n') + nt.assert_equal(ip.user_ns['error'], 'hello\n') @dec.skip_win32 def test_script_bg_out(): ip = get_ipython() ip.run_cell_magic("script", "--bg --out output sh", "echo 'hi'") - nt.assert_equals(ip.user_ns['output'].read(), b'hi\n') + nt.assert_equal(ip.user_ns['output'].read(), b'hi\n') @dec.skip_win32 def test_script_bg_err(): ip = get_ipython() ip.run_cell_magic("script", "--bg --err error sh", "echo 'hello' >&2") - nt.assert_equals(ip.user_ns['error'].read(), b'hello\n') + nt.assert_equal(ip.user_ns['error'].read(), b'hello\n') @dec.skip_win32 def test_script_bg_out_err(): ip = get_ipython() ip.run_cell_magic("script", "--bg --out output --err error sh", "echo 'hi'\necho 'hello' >&2") - nt.assert_equals(ip.user_ns['output'].read(), b'hi\n') - nt.assert_equals(ip.user_ns['error'].read(), b'hello\n') + nt.assert_equal(ip.user_ns['output'].read(), b'hi\n') + nt.assert_equal(ip.user_ns['error'].read(), b'hello\n') def test_script_defaults(): ip = get_ipython() @@ -706,12 +706,12 @@ def test_line_cell_info(): oinfo = ip.object_inspect('%%foo') nt.assert_true(oinfo['found']) nt.assert_true(oinfo['ismagic']) - nt.assert_equals(oinfo['docstring'], FooFoo.cell_foo.__doc__) + nt.assert_equal(oinfo['docstring'], FooFoo.cell_foo.__doc__) oinfo = ip.object_inspect('%foo') nt.assert_true(oinfo['found']) nt.assert_true(oinfo['ismagic']) - nt.assert_equals(oinfo['docstring'], FooFoo.line_foo.__doc__) + nt.assert_equal(oinfo['docstring'], FooFoo.line_foo.__doc__) def test_multiple_magics(): ip = get_ipython() diff --git a/IPython/core/tests/test_magic_terminal.py b/IPython/core/tests/test_magic_terminal.py index 55e3de6..d8905c1 100644 --- a/IPython/core/tests/test_magic_terminal.py +++ b/IPython/core/tests/test_magic_terminal.py @@ -201,4 +201,4 @@ def funcfoo(): ''' ip.user_ns.pop('funcfoo', None) self.paste(s) - nt.assert_equals(ip.user_ns['funcfoo'](), 'fooresult') + nt.assert_equal(ip.user_ns['funcfoo'](), 'fooresult') diff --git a/IPython/core/tests/test_prefilter.py b/IPython/core/tests/test_prefilter.py index 8b26231..c5823e1 100644 --- a/IPython/core/tests/test_prefilter.py +++ b/IPython/core/tests/test_prefilter.py @@ -34,7 +34,7 @@ def test_prefilter(): ] for raw, correct in pairs: - yield nt.assert_equals(ip.prefilter(raw), correct) + yield nt.assert_equal(ip.prefilter(raw), correct) @dec.parametric @@ -44,9 +44,9 @@ def test_autocall_binops(): f = lambda x: x ip.user_ns['f'] = f try: - yield nt.assert_equals(ip.prefilter('f 1'),'f(1)') + yield nt.assert_equal(ip.prefilter('f 1'),'f(1)') for t in ['f +1', 'f -1']: - yield nt.assert_equals(ip.prefilter(t), t) + yield nt.assert_equal(ip.prefilter(t), t) # Run tests again with a more permissive exclude_regexp, which will # allow transformation of binary operations ('f -1' -> 'f(-1)'). @@ -58,8 +58,8 @@ def test_autocall_binops(): ac.exclude_regexp = r'^[,&^\|\*/]|^is |^not |^in |^and |^or ' pm.sort_checkers() - yield nt.assert_equals(ip.prefilter('f -1'), 'f(-1)') - yield nt.assert_equals(ip.prefilter('f +1'), 'f(+1)') + yield nt.assert_equal(ip.prefilter('f -1'), 'f(-1)') + yield nt.assert_equal(ip.prefilter('f +1'), 'f(+1)') finally: pm.unregister_checker(ac) finally: @@ -81,7 +81,7 @@ def test_issue_114(): try: for mgk in ip.magics_manager.lsmagic()['line']: raw = template % mgk - yield nt.assert_equals(ip.prefilter(raw), raw) + yield nt.assert_equal(ip.prefilter(raw), raw) finally: ip.prefilter_manager.multi_line_specials = msp diff --git a/IPython/core/tests/test_profile.py b/IPython/core/tests/test_profile.py index cd945e1..2134728 100644 --- a/IPython/core/tests/test_profile.py +++ b/IPython/core/tests/test_profile.py @@ -141,11 +141,11 @@ def test_list_profiles_in(): found_unicode = True break nt.assert_true(found_unicode) - nt.assert_equals(set(profiles), set(['foo', 'hello'])) + nt.assert_equal(set(profiles), set(['foo', 'hello'])) def test_list_bundled_profiles(): # This variable will need to be updated when a new profile gets bundled bundled_true = [u'cluster', u'math', u'pysh', u'sympy'] bundled = sorted(list_bundled_profiles()) - nt.assert_equals(bundled, bundled_true) + nt.assert_equal(bundled, bundled_true) diff --git a/IPython/core/tests/test_run.py b/IPython/core/tests/test_run.py index f4b4d9e..a508885 100644 --- a/IPython/core/tests/test_run.py +++ b/IPython/core/tests/test_run.py @@ -150,7 +150,7 @@ class TestMagicRunPass(tt.TempFileMixin): self.run_tmpfile() _ip = get_ipython() p2 = _ip.prompt_manager.render('in2').strip() - nt.assert_equals(p2[:3], '...') + nt.assert_equal(p2[:3], '...') def test_run_profile( self ): """Test that the option -p, which invokes the profiler, do not diff --git a/IPython/extensions/tests/test_cythonmagic.py b/IPython/extensions/tests/test_cythonmagic.py index ef28295..af3aa8d 100644 --- a/IPython/extensions/tests/test_cythonmagic.py +++ b/IPython/extensions/tests/test_cythonmagic.py @@ -26,14 +26,14 @@ def setup(): def test_cython_inline(): ip.ex('a=10; b=20') result = ip.run_cell_magic('cython_inline','','return a+b') - nt.assert_equals(result, 30) + nt.assert_equal(result, 30) def test_cython_pyximport(): module_name = '_test_cython_pyximport' ip.run_cell_magic('cython_pyximport', module_name, code) ip.ex('g = f(10)') - nt.assert_equals(ip.user_ns['g'], 20.0) + nt.assert_equal(ip.user_ns['g'], 20.0) try: os.remove(module_name+'.pyx') except OSError: @@ -43,7 +43,7 @@ def test_cython_pyximport(): def test_cython(): ip.run_cell_magic('cython', '', code) ip.ex('g = f(10)') - nt.assert_equals(ip.user_ns['g'], 20.0) + nt.assert_equal(ip.user_ns['g'], 20.0) @dec.skip_win32 @@ -54,5 +54,5 @@ x = sin(0.0) """) ip.user_ns['x'] = 1 ip.run_cell_magic('cython', '-l m', code) - nt.assert_equals(ip.user_ns['x'], 0) + nt.assert_equal(ip.user_ns['x'], 0) diff --git a/IPython/frontend/terminal/console/tests/test_console.py b/IPython/frontend/terminal/console/tests/test_console.py index 946b368..37853e3 100644 --- a/IPython/frontend/terminal/console/tests/test_console.py +++ b/IPython/frontend/terminal/console/tests/test_console.py @@ -45,12 +45,12 @@ def test_console_starts(): p = pexpect.spawn(ipython_cmd, args=['console', '--colors=NoColor']) idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=15) - nt.assert_equals(idx, 0, "expected in prompt") + nt.assert_equal(idx, 0, "expected in prompt") p.sendline('5') idx = p.expect([r'Out\[\d+\]: 5', pexpect.EOF], timeout=5) - nt.assert_equals(idx, 0, "expected out prompt") + nt.assert_equal(idx, 0, "expected out prompt") idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=5) - nt.assert_equals(idx, 0, "expected second in prompt") + nt.assert_equal(idx, 0, "expected second in prompt") # send ctrl-D;ctrl-D to exit p.sendeof() p.sendeof() diff --git a/IPython/lib/tests/test_backgroundjobs.py b/IPython/lib/tests/test_backgroundjobs.py index de6e1f7..e0392b7 100644 --- a/IPython/lib/tests/test_backgroundjobs.py +++ b/IPython/lib/tests/test_backgroundjobs.py @@ -52,7 +52,7 @@ def test_result(): jobs = bg.BackgroundJobManager() j = jobs.new(sleeper) j.join() - nt.assert_equals(j.result['interval'], t_short) + nt.assert_equal(j.result['interval'], t_short) def test_flush(): @@ -60,10 +60,10 @@ def test_flush(): jobs = bg.BackgroundJobManager() j = jobs.new(sleeper) j.join() - nt.assert_equals(len(jobs.completed), 1) - nt.assert_equals(len(jobs.dead), 0) + nt.assert_equal(len(jobs.completed), 1) + nt.assert_equal(len(jobs.dead), 0) jobs.flush() - nt.assert_equals(len(jobs.completed), 0) + nt.assert_equal(len(jobs.completed), 0) def test_dead(): @@ -71,10 +71,10 @@ def test_dead(): jobs = bg.BackgroundJobManager() j = jobs.new(crasher) j.join() - nt.assert_equals(len(jobs.completed), 0) - nt.assert_equals(len(jobs.dead), 1) + nt.assert_equal(len(jobs.completed), 0) + nt.assert_equal(len(jobs.dead), 1) jobs.flush() - nt.assert_equals(len(jobs.dead), 0) + nt.assert_equal(len(jobs.dead), 0) def test_longer(): @@ -84,8 +84,8 @@ def test_longer(): # job as running, but not so long that it makes the test suite noticeably # slower. j = jobs.new(sleeper, 0.1) - nt.assert_equals(len(jobs.running), 1) - nt.assert_equals(len(jobs.completed), 0) + nt.assert_equal(len(jobs.running), 1) + nt.assert_equal(len(jobs.completed), 0) j.join() - nt.assert_equals(len(jobs.running), 0) - nt.assert_equals(len(jobs.completed), 1) + nt.assert_equal(len(jobs.running), 0) + nt.assert_equal(len(jobs.completed), 1) diff --git a/IPython/lib/tests/test_pretty.py b/IPython/lib/tests/test_pretty.py index 240ded2..3c5a0a4 100644 --- a/IPython/lib/tests/test_pretty.py +++ b/IPython/lib/tests/test_pretty.py @@ -59,7 +59,7 @@ def test_indentation(): gotoutput = pretty.pretty(MyList(range(count))) expectedoutput = "MyList(\n" + ",\n".join(" %d" % i for i in range(count)) + ")" - nt.assert_equals(gotoutput, expectedoutput) + nt.assert_equal(gotoutput, expectedoutput) def test_dispatch(): @@ -70,7 +70,7 @@ def test_dispatch(): gotoutput = pretty.pretty(MyDict()) expectedoutput = "MyDict(...)" - nt.assert_equals(gotoutput, expectedoutput) + nt.assert_equal(gotoutput, expectedoutput) def test_callability_checking(): @@ -81,4 +81,4 @@ def test_callability_checking(): gotoutput = pretty.pretty(Dummy2()) expectedoutput = "Dummy1(...)" - nt.assert_equals(gotoutput, expectedoutput) + nt.assert_equal(gotoutput, expectedoutput) diff --git a/IPython/lib/tests/test_security.py b/IPython/lib/tests/test_security.py index 1b58a5f..09e4fa8 100644 --- a/IPython/lib/tests/test_security.py +++ b/IPython/lib/tests/test_security.py @@ -5,17 +5,17 @@ import nose.tools as nt def test_passwd_structure(): p = passwd('passphrase') algorithm, salt, hashed = p.split(':') - nt.assert_equals(algorithm, 'sha1') - nt.assert_equals(len(salt), salt_len) - nt.assert_equals(len(hashed), 40) + nt.assert_equal(algorithm, 'sha1') + nt.assert_equal(len(salt), salt_len) + nt.assert_equal(len(hashed), 40) def test_roundtrip(): p = passwd('passphrase') - nt.assert_equals(passwd_check(p, 'passphrase'), True) + nt.assert_equal(passwd_check(p, 'passphrase'), True) def test_bad(): p = passwd('passphrase') - nt.assert_equals(passwd_check(p, p), False) - nt.assert_equals(passwd_check(p, 'a:b:c:d'), False) - nt.assert_equals(passwd_check(p, 'a:b'), False) + nt.assert_equal(passwd_check(p, p), False) + nt.assert_equal(passwd_check(p, 'a:b:c:d'), False) + nt.assert_equal(passwd_check(p, 'a:b'), False) diff --git a/IPython/testing/tools.py b/IPython/testing/tools.py index a378a69..e9b061a 100644 --- a/IPython/testing/tools.py +++ b/IPython/testing/tools.py @@ -256,12 +256,12 @@ def ipexec_validate(fname, expected_out, expected_err='', # more informative than simply having an empty stdout. if err: if expected_err: - nt.assert_equals(err.strip(), expected_err.strip()) + nt.assert_equal(err.strip(), expected_err.strip()) else: raise ValueError('Running file %r produced error: %r' % (fname, err)) # If no errors or output on stderr was expected, match stdout - nt.assert_equals(out.strip(), expected_out.strip()) + nt.assert_equal(out.strip(), expected_out.strip()) class TempFileMixin(object): diff --git a/IPython/utils/tests/test_io.py b/IPython/utils/tests/test_io.py index ba169ba..86ba864 100644 --- a/IPython/utils/tests/test_io.py +++ b/IPython/utils/tests/test_io.py @@ -52,7 +52,7 @@ class TeeTestCase(dec.ParametricTestCase): print(text, end='', file=chan) setattr(sys, channel, std_ori) trap_val = trap.getvalue() - nt.assert_equals(chan.getvalue(), text) + nt.assert_equal(chan.getvalue(), text) if check=='close': tee.close() else: @@ -82,5 +82,5 @@ def test_capture_output(): print('hi, stdout') print('hi, stderr', file=sys.stderr) - nt.assert_equals(io.stdout, 'hi, stdout\n') - nt.assert_equals(io.stderr, 'hi, stderr\n') + nt.assert_equal(io.stdout, 'hi, stdout\n') + nt.assert_equal(io.stderr, 'hi, stderr\n') diff --git a/IPython/utils/tests/test_path.py b/IPython/utils/tests/test_path.py index 94e9755..8e7fa49 100644 --- a/IPython/utils/tests/test_path.py +++ b/IPython/utils/tests/test_path.py @@ -373,13 +373,13 @@ def test_get_ipython_module_path(): @dec.skip_if_not_win32 def test_get_long_path_name_win32(): p = path.get_long_path_name('c:\\docume~1') - nt.assert_equals(p,u'c:\\Documents and Settings') + nt.assert_equal(p,u'c:\\Documents and Settings') @dec.skip_win32 def test_get_long_path_name(): p = path.get_long_path_name('/usr/local') - nt.assert_equals(p,'/usr/local') + nt.assert_equal(p,'/usr/local') @dec.skip_win32 # can't create not-user-writable dir on win @with_environment @@ -399,36 +399,36 @@ def test_not_writable_ipdir(): def test_unquote_filename(): for win32 in (True, False): - nt.assert_equals(path.unquote_filename('foo.py', win32=win32), 'foo.py') - nt.assert_equals(path.unquote_filename('foo bar.py', win32=win32), 'foo bar.py') - nt.assert_equals(path.unquote_filename('"foo.py"', win32=True), 'foo.py') - nt.assert_equals(path.unquote_filename('"foo bar.py"', win32=True), 'foo bar.py') - nt.assert_equals(path.unquote_filename("'foo.py'", win32=True), 'foo.py') - nt.assert_equals(path.unquote_filename("'foo bar.py'", win32=True), 'foo bar.py') - nt.assert_equals(path.unquote_filename('"foo.py"', win32=False), '"foo.py"') - nt.assert_equals(path.unquote_filename('"foo bar.py"', win32=False), '"foo bar.py"') - nt.assert_equals(path.unquote_filename("'foo.py'", win32=False), "'foo.py'") - nt.assert_equals(path.unquote_filename("'foo bar.py'", win32=False), "'foo bar.py'") + nt.assert_equal(path.unquote_filename('foo.py', win32=win32), 'foo.py') + nt.assert_equal(path.unquote_filename('foo bar.py', win32=win32), 'foo bar.py') + nt.assert_equal(path.unquote_filename('"foo.py"', win32=True), 'foo.py') + nt.assert_equal(path.unquote_filename('"foo bar.py"', win32=True), 'foo bar.py') + nt.assert_equal(path.unquote_filename("'foo.py'", win32=True), 'foo.py') + nt.assert_equal(path.unquote_filename("'foo bar.py'", win32=True), 'foo bar.py') + nt.assert_equal(path.unquote_filename('"foo.py"', win32=False), '"foo.py"') + nt.assert_equal(path.unquote_filename('"foo bar.py"', win32=False), '"foo bar.py"') + nt.assert_equal(path.unquote_filename("'foo.py'", win32=False), "'foo.py'") + nt.assert_equal(path.unquote_filename("'foo bar.py'", win32=False), "'foo bar.py'") @with_environment def test_get_py_filename(): os.chdir(TMP_TEST_DIR) for win32 in (True, False): with make_tempfile('foo.py'): - nt.assert_equals(path.get_py_filename('foo.py', force_win32=win32), 'foo.py') - nt.assert_equals(path.get_py_filename('foo', force_win32=win32), 'foo.py') + nt.assert_equal(path.get_py_filename('foo.py', force_win32=win32), 'foo.py') + nt.assert_equal(path.get_py_filename('foo', force_win32=win32), 'foo.py') with make_tempfile('foo'): - nt.assert_equals(path.get_py_filename('foo', force_win32=win32), 'foo') + nt.assert_equal(path.get_py_filename('foo', force_win32=win32), 'foo') nt.assert_raises(IOError, path.get_py_filename, 'foo.py', force_win32=win32) nt.assert_raises(IOError, path.get_py_filename, 'foo', force_win32=win32) nt.assert_raises(IOError, path.get_py_filename, 'foo.py', force_win32=win32) true_fn = 'foo with spaces.py' with make_tempfile(true_fn): - nt.assert_equals(path.get_py_filename('foo with spaces', force_win32=win32), true_fn) - nt.assert_equals(path.get_py_filename('foo with spaces.py', force_win32=win32), true_fn) + nt.assert_equal(path.get_py_filename('foo with spaces', force_win32=win32), true_fn) + nt.assert_equal(path.get_py_filename('foo with spaces.py', force_win32=win32), true_fn) if win32: - nt.assert_equals(path.get_py_filename('"foo with spaces.py"', force_win32=True), true_fn) - nt.assert_equals(path.get_py_filename("'foo with spaces.py'", force_win32=True), true_fn) + nt.assert_equal(path.get_py_filename('"foo with spaces.py"', force_win32=True), true_fn) + nt.assert_equal(path.get_py_filename("'foo with spaces.py'", force_win32=True), true_fn) else: nt.assert_raises(IOError, path.get_py_filename, '"foo with spaces.py"', force_win32=False) nt.assert_raises(IOError, path.get_py_filename, "'foo with spaces.py'", force_win32=False) diff --git a/IPython/utils/tests/test_process.py b/IPython/utils/tests/test_process.py index 3827a45..1e1a8f3 100644 --- a/IPython/utils/tests/test_process.py +++ b/IPython/utils/tests/test_process.py @@ -30,7 +30,7 @@ from IPython.testing import tools as tt def test_find_cmd_python(): """Make sure we find sys.exectable for python.""" - nt.assert_equals(find_cmd('python'), sys.executable) + nt.assert_equal(find_cmd('python'), sys.executable) @dec.skip_win32 diff --git a/IPython/utils/tests/test_pycolorize.py b/IPython/utils/tests/test_pycolorize.py index 8ee849c..52c63d5 100644 --- a/IPython/utils/tests/test_pycolorize.py +++ b/IPython/utils/tests/test_pycolorize.py @@ -30,5 +30,5 @@ def test_unicode_colorize(): p = Parser() f1 = p.format('1/0', 'str') f2 = p.format(u'1/0', 'str') - nt.assert_equals(f1, f2) + nt.assert_equal(f1, f2) diff --git a/IPython/utils/tests/test_text.py b/IPython/utils/tests/test_text.py index 8822262..bc795f8 100644 --- a/IPython/utils/tests/test_text.py +++ b/IPython/utils/tests/test_text.py @@ -32,11 +32,11 @@ def test_columnize(): size = 5 items = [l*size for l in 'abc'] out = text.columnize(items, displaywidth=80) - nt.assert_equals(out, 'aaaaa bbbbb ccccc\n') + nt.assert_equal(out, 'aaaaa bbbbb ccccc\n') out = text.columnize(items, displaywidth=12) - nt.assert_equals(out, 'aaaaa ccccc\nbbbbb\n') + nt.assert_equal(out, 'aaaaa ccccc\nbbbbb\n') out = text.columnize(items, displaywidth=10) - nt.assert_equals(out, 'aaaaa\nbbbbb\nccccc\n') + nt.assert_equal(out, 'aaaaa\nbbbbb\nccccc\n') def test_columnize_random(): """Test with random input to hopfully catch edge case """ @@ -60,31 +60,31 @@ def test_columnize_medium(): size = 40 items = [l*size for l in 'abc'] out = text.columnize(items, displaywidth=80) - nt.assert_equals(out, '\n'.join(items+[''])) + nt.assert_equal(out, '\n'.join(items+[''])) def test_columnize_long(): """Test columnize with inputs longer than the display window""" size = 11 items = [l*size for l in 'abc'] out = text.columnize(items, displaywidth=size-1) - nt.assert_equals(out, '\n'.join(items+[''])) + nt.assert_equal(out, '\n'.join(items+[''])) def eval_formatter_check(f): ns = dict(n=12, pi=math.pi, stuff='hello there', os=os, u=u"café", b="café") s = f.format("{n} {n//4} {stuff.split()[0]}", **ns) - nt.assert_equals(s, "12 3 hello") + nt.assert_equal(s, "12 3 hello") s = f.format(' '.join(['{n//%i}'%i for i in range(1,8)]), **ns) - nt.assert_equals(s, "12 6 4 3 2 2 1") + nt.assert_equal(s, "12 6 4 3 2 2 1") s = f.format('{[n//i for i in range(1,8)]}', **ns) - nt.assert_equals(s, "[12, 6, 4, 3, 2, 2, 1]") + nt.assert_equal(s, "[12, 6, 4, 3, 2, 2, 1]") s = f.format("{stuff!s}", **ns) - nt.assert_equals(s, ns['stuff']) + nt.assert_equal(s, ns['stuff']) s = f.format("{stuff!r}", **ns) - nt.assert_equals(s, repr(ns['stuff'])) + nt.assert_equal(s, repr(ns['stuff'])) # Check with unicode: s = f.format("{u}", **ns) - nt.assert_equals(s, ns['u']) + nt.assert_equal(s, ns['u']) # This decodes in a platform dependent manner, but it shouldn't error out s = f.format("{b}", **ns) @@ -93,11 +93,11 @@ def eval_formatter_check(f): def eval_formatter_slicing_check(f): ns = dict(n=12, pi=math.pi, stuff='hello there', os=os) s = f.format(" {stuff.split()[:]} ", **ns) - nt.assert_equals(s, " ['hello', 'there'] ") + nt.assert_equal(s, " ['hello', 'there'] ") s = f.format(" {stuff.split()[::-1]} ", **ns) - nt.assert_equals(s, " ['there', 'hello'] ") + nt.assert_equal(s, " ['there', 'hello'] ") s = f.format("{stuff[::2]}", **ns) - nt.assert_equals(s, ns['stuff'][::2]) + nt.assert_equal(s, ns['stuff'][::2]) nt.assert_raises(SyntaxError, f.format, "{n:x}", **ns) @@ -105,10 +105,10 @@ def eval_formatter_no_slicing_check(f): ns = dict(n=12, pi=math.pi, stuff='hello there', os=os) s = f.format('{n:x} {pi**2:+f}', **ns) - nt.assert_equals(s, "c +9.869604") + nt.assert_equal(s, "c +9.869604") s = f.format('{stuff[slice(1,4)]}', **ns) - nt.assert_equals(s, 'ell') + nt.assert_equal(s, 'ell') nt.assert_raises(SyntaxError, f.format, "{a[:]}") @@ -129,25 +129,25 @@ def test_dollar_formatter(): ns = dict(n=12, pi=math.pi, stuff='hello there', os=os) s = f.format("$n", **ns) - nt.assert_equals(s, "12") + nt.assert_equal(s, "12") s = f.format("$n.real", **ns) - nt.assert_equals(s, "12") + nt.assert_equal(s, "12") s = f.format("$n/{stuff[:5]}", **ns) - nt.assert_equals(s, "12/hello") + nt.assert_equal(s, "12/hello") s = f.format("$n $$HOME", **ns) - nt.assert_equals(s, "12 $HOME") + nt.assert_equal(s, "12 $HOME") s = f.format("${foo}", foo="HOME") - nt.assert_equals(s, "$HOME") + nt.assert_equal(s, "$HOME") def test_long_substr(): data = ['hi'] - nt.assert_equals(text.long_substr(data), 'hi') + nt.assert_equal(text.long_substr(data), 'hi') def test_long_substr2(): data = ['abc', 'abd', 'abf', 'ab'] - nt.assert_equals(text.long_substr(data), 'ab') + nt.assert_equal(text.long_substr(data), 'ab') def test_strip_email(): @@ -161,10 +161,10 @@ def test_strip_email(): ... return x+1 ... >>> zz = f(2.5)""" - nt.assert_equals(text.strip_email_quotes(src), cln) + nt.assert_equal(text.strip_email_quotes(src), cln) def test_strip_email2(): src = '> > > list()' cln = 'list()' - nt.assert_equals(text.strip_email_quotes(src), cln) + nt.assert_equal(text.strip_email_quotes(src), cln) diff --git a/IPython/zmq/tests/test_embed_kernel.py b/IPython/zmq/tests/test_embed_kernel.py index 0bf8f62..dfb6938 100644 --- a/IPython/zmq/tests/test_embed_kernel.py +++ b/IPython/zmq/tests/test_embed_kernel.py @@ -117,14 +117,14 @@ def test_embed_kernel_basic(): msg_id = shell.execute("c=a*2") msg = shell.get_msg(block=True, timeout=2) content = msg['content'] - nt.assert_equals(content['status'], u'ok') + nt.assert_equal(content['status'], u'ok') # oinfo c (should be 10) msg_id = shell.object_info('c') msg = shell.get_msg(block=True, timeout=2) content = msg['content'] nt.assert_true(content['found']) - nt.assert_equals(content['string_form'], u'10') + nt.assert_equal(content['string_form'], u'10') def test_embed_kernel_namespace(): """IPython.embed_kernel() inherits calling namespace""" @@ -146,14 +146,14 @@ def test_embed_kernel_namespace(): msg = shell.get_msg(block=True, timeout=2) content = msg['content'] nt.assert_true(content['found']) - nt.assert_equals(content['string_form'], u'5') + nt.assert_equal(content['string_form'], u'5') # oinfo b (str) msg_id = shell.object_info('b') msg = shell.get_msg(block=True, timeout=2) content = msg['content'] nt.assert_true(content['found']) - nt.assert_equals(content['string_form'], u'hi there') + nt.assert_equal(content['string_form'], u'hi there') # oinfo c (undefined) msg_id = shell.object_info('c') @@ -183,7 +183,7 @@ def test_embed_kernel_reentrant(): msg = shell.get_msg(block=True, timeout=2) content = msg['content'] nt.assert_true(content['found']) - nt.assert_equals(content['string_form'], unicode(i)) + nt.assert_equal(content['string_form'], unicode(i)) # exit from embed_kernel shell.execute("get_ipython().exit_now = True") diff --git a/IPython/zmq/tests/test_message_spec.py b/IPython/zmq/tests/test_message_spec.py index 4c85650..2bbb90c 100644 --- a/IPython/zmq/tests/test_message_spec.py +++ b/IPython/zmq/tests/test_message_spec.py @@ -68,12 +68,12 @@ def execute(code='', **kwargs): list(validate_message(reply, 'execute_reply', msg_id)) busy = sub.get_msg(timeout=2) list(validate_message(busy, 'status', msg_id)) - nt.assert_equals(busy['content']['execution_state'], 'busy') + nt.assert_equal(busy['content']['execution_state'], 'busy') if not kwargs.get('silent'): pyin = sub.get_msg(timeout=2) list(validate_message(pyin, 'pyin', msg_id)) - nt.assert_equals(pyin['content']['code'], code) + nt.assert_equal(pyin['content']['code'], code) return msg_id, reply['content'] @@ -245,7 +245,7 @@ def validate_message(msg, msg_type=None, parent=None): """ RMessage().check(msg) if msg_type: - yield nt.assert_equals(msg['msg_type'], msg_type) + yield nt.assert_equal(msg['msg_type'], msg_type) if parent: yield nt.assert_equal(msg['parent_header']['msg_id'], parent) content = msg['content'] @@ -280,7 +280,7 @@ def test_execute_silent(): status = KM.sub_channel.get_msg(timeout=2) for tst in validate_message(status, 'status', msg_id): yield tst - nt.assert_equals(status['content']['execution_state'], 'idle') + nt.assert_equal(status['content']['execution_state'], 'idle') yield nt.assert_raises(Empty, KM.sub_channel.get_msg, timeout=0.1) count = reply['execution_count'] @@ -291,11 +291,11 @@ def test_execute_silent(): status = KM.sub_channel.get_msg(timeout=2) for tst in validate_message(status, 'status', msg_id): yield tst - yield nt.assert_equals(status['content']['execution_state'], 'idle') + yield nt.assert_equal(status['content']['execution_state'], 'idle') yield nt.assert_raises(Empty, KM.sub_channel.get_msg, timeout=0.1) count_2 = reply['execution_count'] - yield nt.assert_equals(count_2, count) + yield nt.assert_equal(count_2, count) @dec.parametric @@ -303,8 +303,8 @@ def test_execute_error(): flush_channels() msg_id, reply = execute(code='1/0') - yield nt.assert_equals(reply['status'], 'error') - yield nt.assert_equals(reply['ename'], 'ZeroDivisionError') + yield nt.assert_equal(reply['status'], 'error') + yield nt.assert_equal(reply['ename'], 'ZeroDivisionError') pyerr = KM.sub_channel.get_msg(timeout=2) for tst in validate_message(pyerr, 'pyerr', msg_id): @@ -322,7 +322,7 @@ def test_execute_inc(): msg_id, reply = execute(code='x=2') count_2 = reply['execution_count'] - nt.assert_equals(count_2, count+1) + nt.assert_equal(count_2, count+1) def test_user_variables(): @@ -330,7 +330,7 @@ def test_user_variables(): msg_id, reply = execute(code='x=1', user_variables=['x']) user_variables = reply['user_variables'] - nt.assert_equals(user_variables, {u'x' : u'1'}) + nt.assert_equal(user_variables, {u'x' : u'1'}) def test_user_expressions(): @@ -338,7 +338,7 @@ def test_user_expressions(): msg_id, reply = execute(code='x=1', user_expressions=dict(foo='x+1')) user_expressions = reply['user_expressions'] - nt.assert_equals(user_expressions, {u'foo' : u'2'}) + nt.assert_equal(user_expressions, {u'foo' : u'2'}) @dec.parametric @@ -387,7 +387,7 @@ def test_oinfo_detail(): yield nt.assert_true(content['found']) argspec = content['argspec'] yield nt.assert_true(isinstance(argspec, dict), "expected non-empty argspec dict, got %r" % argspec) - yield nt.assert_equals(argspec['defaults'], [0]) + yield nt.assert_equal(argspec['defaults'], [0]) @dec.parametric @@ -434,8 +434,8 @@ def test_stream(): for tst in validate_message(stdout, 'stream', msg_id): yield tst content = stdout['content'] - yield nt.assert_equals(content['name'], u'stdout') - yield nt.assert_equals(content['data'], u'hi\n') + yield nt.assert_equal(content['name'], u'stdout') + yield nt.assert_equal(content['data'], u'hi\n') @dec.parametric @@ -448,5 +448,5 @@ def test_display_data(): for tst in validate_message(display, 'display_data', parent=msg_id): yield tst data = display['content']['data'] - yield nt.assert_equals(data['text/plain'], u'1') + yield nt.assert_equal(data['text/plain'], u'1')