##// END OF EJS Templates
s/nt.assert_equals/nt.assert_equal/
Bradley M. Froehle -
Show More
@@ -52,7 +52,7 b' def test_protect_filename():'
52 # run the actual tests
52 # run the actual tests
53 for s1, s2 in pairs:
53 for s1, s2 in pairs:
54 s1p = completer.protect_filename(s1)
54 s1p = completer.protect_filename(s1)
55 nt.assert_equals(s1p, s2)
55 nt.assert_equal(s1p, s2)
56
56
57
57
58 def check_line_split(splitter, test_specs):
58 def check_line_split(splitter, test_specs):
@@ -28,8 +28,8 b' def test_longer_repr():'
28 a = '1234567890'* 7
28 a = '1234567890'* 7
29 ar = "'1234567890123456789012345678901234567890123456789012345678901234567890'"
29 ar = "'1234567890123456789012345678901234567890123456789012345678901234567890'"
30 a_trunc = "'123456789012...8901234567890'"
30 a_trunc = "'123456789012...8901234567890'"
31 nt.assert_equals(trepr(a), a_trunc)
31 nt.assert_equal(trepr(a), a_trunc)
32 # The creation of our tracer modifies the repr module's repr function
32 # The creation of our tracer modifies the repr module's repr function
33 # in-place, since that global is used directly by the stdlib's pdb module.
33 # in-place, since that global is used directly by the stdlib's pdb module.
34 t = debugger.Tracer()
34 t = debugger.Tracer()
35 nt.assert_equals(trepr(a), ar)
35 nt.assert_equal(trepr(a), ar)
@@ -36,16 +36,16 b' def foo_printer(obj, pp, cycle):'
36 def test_pretty():
36 def test_pretty():
37 f = PlainTextFormatter()
37 f = PlainTextFormatter()
38 f.for_type(A, foo_printer)
38 f.for_type(A, foo_printer)
39 nt.assert_equals(f(A()), 'foo')
39 nt.assert_equal(f(A()), 'foo')
40 nt.assert_equals(f(B()), 'foo')
40 nt.assert_equal(f(B()), 'foo')
41 nt.assert_equals(f(GoodPretty()), 'foo')
41 nt.assert_equal(f(GoodPretty()), 'foo')
42 # Just don't raise an exception for the following:
42 # Just don't raise an exception for the following:
43 f(BadPretty())
43 f(BadPretty())
44
44
45 f.pprint = False
45 f.pprint = False
46 nt.assert_equals(f(A()), 'A()')
46 nt.assert_equal(f(A()), 'A()')
47 nt.assert_equals(f(B()), 'B()')
47 nt.assert_equal(f(B()), 'B()')
48 nt.assert_equals(f(GoodPretty()), 'GoodPretty()')
48 nt.assert_equal(f(GoodPretty()), 'GoodPretty()')
49
49
50
50
51 def test_deferred():
51 def test_deferred():
@@ -54,29 +54,29 b' def test_deferred():'
54 def test_precision():
54 def test_precision():
55 """test various values for float_precision."""
55 """test various values for float_precision."""
56 f = PlainTextFormatter()
56 f = PlainTextFormatter()
57 nt.assert_equals(f(pi), repr(pi))
57 nt.assert_equal(f(pi), repr(pi))
58 f.float_precision = 0
58 f.float_precision = 0
59 if numpy:
59 if numpy:
60 po = numpy.get_printoptions()
60 po = numpy.get_printoptions()
61 nt.assert_equals(po['precision'], 0)
61 nt.assert_equal(po['precision'], 0)
62 nt.assert_equals(f(pi), '3')
62 nt.assert_equal(f(pi), '3')
63 f.float_precision = 2
63 f.float_precision = 2
64 if numpy:
64 if numpy:
65 po = numpy.get_printoptions()
65 po = numpy.get_printoptions()
66 nt.assert_equals(po['precision'], 2)
66 nt.assert_equal(po['precision'], 2)
67 nt.assert_equals(f(pi), '3.14')
67 nt.assert_equal(f(pi), '3.14')
68 f.float_precision = '%g'
68 f.float_precision = '%g'
69 if numpy:
69 if numpy:
70 po = numpy.get_printoptions()
70 po = numpy.get_printoptions()
71 nt.assert_equals(po['precision'], 2)
71 nt.assert_equal(po['precision'], 2)
72 nt.assert_equals(f(pi), '3.14159')
72 nt.assert_equal(f(pi), '3.14159')
73 f.float_precision = '%e'
73 f.float_precision = '%e'
74 nt.assert_equals(f(pi), '3.141593e+00')
74 nt.assert_equal(f(pi), '3.141593e+00')
75 f.float_precision = ''
75 f.float_precision = ''
76 if numpy:
76 if numpy:
77 po = numpy.get_printoptions()
77 po = numpy.get_printoptions()
78 nt.assert_equals(po['precision'], 8)
78 nt.assert_equal(po['precision'], 8)
79 nt.assert_equals(f(pi), repr(pi))
79 nt.assert_equal(f(pi), repr(pi))
80
80
81 def test_bad_precision():
81 def test_bad_precision():
82 """test various invalid values for float_precision."""
82 """test various invalid values for float_precision."""
@@ -166,4 +166,4 b' def test_handlers():'
166 ])
166 ])
167 ip.magic('autocall 1')
167 ip.magic('autocall 1')
168
168
169 nt.assert_equals(failures, [])
169 nt.assert_equal(failures, [])
@@ -139,7 +139,7 b' def test_hist_file_config():'
139 cfg.HistoryManager.hist_file = tfile.name
139 cfg.HistoryManager.hist_file = tfile.name
140 try:
140 try:
141 hm = HistoryManager(shell=get_ipython(), config=cfg)
141 hm = HistoryManager(shell=get_ipython(), config=cfg)
142 nt.assert_equals(hm.hist_file, cfg.HistoryManager.hist_file)
142 nt.assert_equal(hm.hist_file, cfg.HistoryManager.hist_file)
143 finally:
143 finally:
144 try:
144 try:
145 os.remove(tfile.name)
145 os.remove(tfile.name)
@@ -425,13 +425,13 b' class InteractiveLoopTestCase(unittest.TestCase):'
425 def test_LineInfo():
425 def test_LineInfo():
426 """Simple test for LineInfo construction and str()"""
426 """Simple test for LineInfo construction and str()"""
427 linfo = isp.LineInfo(' %cd /home')
427 linfo = isp.LineInfo(' %cd /home')
428 nt.assert_equals(str(linfo), 'LineInfo [ |%|cd|/home]')
428 nt.assert_equal(str(linfo), 'LineInfo [ |%|cd|/home]')
429
429
430 # Transformer tests
430 # Transformer tests
431 def transform_checker(tests, func):
431 def transform_checker(tests, func):
432 """Utility to loop over test inputs"""
432 """Utility to loop over test inputs"""
433 for inp, tr in tests:
433 for inp, tr in tests:
434 nt.assert_equals(func(inp), tr)
434 nt.assert_equal(func(inp), tr)
435
435
436 # Data for all the syntax tests in the form of lists of pairs of
436 # Data for all the syntax tests in the form of lists of pairs of
437 # raw/transformed input. We store it here as a global dict so that we can use
437 # raw/transformed input. We store it here as a global dict so that we can use
@@ -45,8 +45,8 b' def test_reset():'
45
45
46 # Finally, check that all namespaces have only as many variables as we
46 # Finally, check that all namespaces have only as many variables as we
47 # expect to find in them:
47 # expect to find in them:
48 nt.assert_equals(len(ip.user_ns), nvars_user_ns)
48 nt.assert_equal(len(ip.user_ns), nvars_user_ns)
49 nt.assert_equals(len(ip.user_ns_hidden), nvars_hidden)
49 nt.assert_equal(len(ip.user_ns_hidden), nvars_hidden)
50
50
51
51
52 # Tests for reporting of exceptions in various modes, handling of SystemExit,
52 # Tests for reporting of exceptions in various modes, handling of SystemExit,
@@ -231,7 +231,7 b' def test_run_cell():'
231 ip.run_cell('a = 10\na+=1')
231 ip.run_cell('a = 10\na+=1')
232 ip.run_cell('assert a == 11\nassert 1')
232 ip.run_cell('assert a == 11\nassert 1')
233
233
234 nt.assert_equals(ip.user_ns['a'], 11)
234 nt.assert_equal(ip.user_ns['a'], 11)
235 complex = textwrap.dedent("""
235 complex = textwrap.dedent("""
236 if 1:
236 if 1:
237 print "hello"
237 print "hello"
@@ -255,6 +255,6 b' def test_run_cell():'
255 def test_db():
255 def test_db():
256 """Test the internal database used for variable persistence."""
256 """Test the internal database used for variable persistence."""
257 ip.db['__unittest_'] = 12
257 ip.db['__unittest_'] = 12
258 nt.assert_equals(ip.db['__unittest_'], 12)
258 nt.assert_equal(ip.db['__unittest_'], 12)
259 del ip.db['__unittest_']
259 del ip.db['__unittest_']
260 assert '__unittest_' not in ip.db
260 assert '__unittest_' not in ip.db
@@ -74,7 +74,7 b' def test_magic_parse_options():'
74 expected = 'c:x'
74 expected = 'c:x'
75 else:
75 else:
76 expected = path
76 expected = path
77 nt.assert_equals(opts['f'], expected)
77 nt.assert_equal(opts['f'], expected)
78
78
79 def test_magic_parse_long_options():
79 def test_magic_parse_long_options():
80 """Magic.parse_options can handle --foo=bar long options"""
80 """Magic.parse_options can handle --foo=bar long options"""
@@ -280,7 +280,7 b' def test_tb_syntaxerror():'
280 sys.stdout = save_stdout
280 sys.stdout = save_stdout
281 # trim output, and only check the last line
281 # trim output, and only check the last line
282 last_line = out.rstrip().splitlines()[-1].strip()
282 last_line = out.rstrip().splitlines()[-1].strip()
283 nt.assert_equals(last_line, "SyntaxError: invalid syntax")
283 nt.assert_equal(last_line, "SyntaxError: invalid syntax")
284
284
285
285
286 @py3compat.doctest_refactor_print
286 @py3compat.doctest_refactor_print
@@ -532,10 +532,10 b' class CellMagicTestCase(TestCase):'
532 def check_ident(self, magic):
532 def check_ident(self, magic):
533 # Manually called, we get the result
533 # Manually called, we get the result
534 out = _ip.run_cell_magic(magic, 'a', 'b')
534 out = _ip.run_cell_magic(magic, 'a', 'b')
535 nt.assert_equals(out, ('a','b'))
535 nt.assert_equal(out, ('a','b'))
536 # Via run_cell, it goes into the user's namespace via displayhook
536 # Via run_cell, it goes into the user's namespace via displayhook
537 _ip.run_cell('%%' + magic +' c\nd')
537 _ip.run_cell('%%' + magic +' c\nd')
538 nt.assert_equals(_ip.user_ns['_'], ('c','d'))
538 nt.assert_equal(_ip.user_ns['_'], ('c','d'))
539
539
540 def test_cell_magic_func_deco(self):
540 def test_cell_magic_func_deco(self):
541 "Cell magic using simple decorator"
541 "Cell magic using simple decorator"
@@ -578,7 +578,7 b' class CellMagicTestCase(TestCase):'
578 self.check_ident('cellm4')
578 self.check_ident('cellm4')
579 # Check that nothing is registered as 'cellm33'
579 # Check that nothing is registered as 'cellm33'
580 c33 = _ip.find_cell_magic('cellm33')
580 c33 = _ip.find_cell_magic('cellm33')
581 nt.assert_equals(c33, None)
581 nt.assert_equal(c33, None)
582
582
583 def test_file():
583 def test_file():
584 """Basic %%file"""
584 """Basic %%file"""
@@ -637,39 +637,39 b' def test_script_config():'
637 def test_script_out():
637 def test_script_out():
638 ip = get_ipython()
638 ip = get_ipython()
639 ip.run_cell_magic("script", "--out output sh", "echo 'hi'")
639 ip.run_cell_magic("script", "--out output sh", "echo 'hi'")
640 nt.assert_equals(ip.user_ns['output'], 'hi\n')
640 nt.assert_equal(ip.user_ns['output'], 'hi\n')
641
641
642 @dec.skip_win32
642 @dec.skip_win32
643 def test_script_err():
643 def test_script_err():
644 ip = get_ipython()
644 ip = get_ipython()
645 ip.run_cell_magic("script", "--err error sh", "echo 'hello' >&2")
645 ip.run_cell_magic("script", "--err error sh", "echo 'hello' >&2")
646 nt.assert_equals(ip.user_ns['error'], 'hello\n')
646 nt.assert_equal(ip.user_ns['error'], 'hello\n')
647
647
648 @dec.skip_win32
648 @dec.skip_win32
649 def test_script_out_err():
649 def test_script_out_err():
650 ip = get_ipython()
650 ip = get_ipython()
651 ip.run_cell_magic("script", "--out output --err error sh", "echo 'hi'\necho 'hello' >&2")
651 ip.run_cell_magic("script", "--out output --err error sh", "echo 'hi'\necho 'hello' >&2")
652 nt.assert_equals(ip.user_ns['output'], 'hi\n')
652 nt.assert_equal(ip.user_ns['output'], 'hi\n')
653 nt.assert_equals(ip.user_ns['error'], 'hello\n')
653 nt.assert_equal(ip.user_ns['error'], 'hello\n')
654
654
655 @dec.skip_win32
655 @dec.skip_win32
656 def test_script_bg_out():
656 def test_script_bg_out():
657 ip = get_ipython()
657 ip = get_ipython()
658 ip.run_cell_magic("script", "--bg --out output sh", "echo 'hi'")
658 ip.run_cell_magic("script", "--bg --out output sh", "echo 'hi'")
659 nt.assert_equals(ip.user_ns['output'].read(), b'hi\n')
659 nt.assert_equal(ip.user_ns['output'].read(), b'hi\n')
660
660
661 @dec.skip_win32
661 @dec.skip_win32
662 def test_script_bg_err():
662 def test_script_bg_err():
663 ip = get_ipython()
663 ip = get_ipython()
664 ip.run_cell_magic("script", "--bg --err error sh", "echo 'hello' >&2")
664 ip.run_cell_magic("script", "--bg --err error sh", "echo 'hello' >&2")
665 nt.assert_equals(ip.user_ns['error'].read(), b'hello\n')
665 nt.assert_equal(ip.user_ns['error'].read(), b'hello\n')
666
666
667 @dec.skip_win32
667 @dec.skip_win32
668 def test_script_bg_out_err():
668 def test_script_bg_out_err():
669 ip = get_ipython()
669 ip = get_ipython()
670 ip.run_cell_magic("script", "--bg --out output --err error sh", "echo 'hi'\necho 'hello' >&2")
670 ip.run_cell_magic("script", "--bg --out output --err error sh", "echo 'hi'\necho 'hello' >&2")
671 nt.assert_equals(ip.user_ns['output'].read(), b'hi\n')
671 nt.assert_equal(ip.user_ns['output'].read(), b'hi\n')
672 nt.assert_equals(ip.user_ns['error'].read(), b'hello\n')
672 nt.assert_equal(ip.user_ns['error'].read(), b'hello\n')
673
673
674 def test_script_defaults():
674 def test_script_defaults():
675 ip = get_ipython()
675 ip = get_ipython()
@@ -706,12 +706,12 b' def test_line_cell_info():'
706 oinfo = ip.object_inspect('%%foo')
706 oinfo = ip.object_inspect('%%foo')
707 nt.assert_true(oinfo['found'])
707 nt.assert_true(oinfo['found'])
708 nt.assert_true(oinfo['ismagic'])
708 nt.assert_true(oinfo['ismagic'])
709 nt.assert_equals(oinfo['docstring'], FooFoo.cell_foo.__doc__)
709 nt.assert_equal(oinfo['docstring'], FooFoo.cell_foo.__doc__)
710
710
711 oinfo = ip.object_inspect('%foo')
711 oinfo = ip.object_inspect('%foo')
712 nt.assert_true(oinfo['found'])
712 nt.assert_true(oinfo['found'])
713 nt.assert_true(oinfo['ismagic'])
713 nt.assert_true(oinfo['ismagic'])
714 nt.assert_equals(oinfo['docstring'], FooFoo.line_foo.__doc__)
714 nt.assert_equal(oinfo['docstring'], FooFoo.line_foo.__doc__)
715
715
716 def test_multiple_magics():
716 def test_multiple_magics():
717 ip = get_ipython()
717 ip = get_ipython()
@@ -201,4 +201,4 b' def funcfoo():'
201 '''
201 '''
202 ip.user_ns.pop('funcfoo', None)
202 ip.user_ns.pop('funcfoo', None)
203 self.paste(s)
203 self.paste(s)
204 nt.assert_equals(ip.user_ns['funcfoo'](), 'fooresult')
204 nt.assert_equal(ip.user_ns['funcfoo'](), 'fooresult')
@@ -34,7 +34,7 b' def test_prefilter():'
34 ]
34 ]
35
35
36 for raw, correct in pairs:
36 for raw, correct in pairs:
37 yield nt.assert_equals(ip.prefilter(raw), correct)
37 yield nt.assert_equal(ip.prefilter(raw), correct)
38
38
39
39
40 @dec.parametric
40 @dec.parametric
@@ -44,9 +44,9 b' def test_autocall_binops():'
44 f = lambda x: x
44 f = lambda x: x
45 ip.user_ns['f'] = f
45 ip.user_ns['f'] = f
46 try:
46 try:
47 yield nt.assert_equals(ip.prefilter('f 1'),'f(1)')
47 yield nt.assert_equal(ip.prefilter('f 1'),'f(1)')
48 for t in ['f +1', 'f -1']:
48 for t in ['f +1', 'f -1']:
49 yield nt.assert_equals(ip.prefilter(t), t)
49 yield nt.assert_equal(ip.prefilter(t), t)
50
50
51 # Run tests again with a more permissive exclude_regexp, which will
51 # Run tests again with a more permissive exclude_regexp, which will
52 # allow transformation of binary operations ('f -1' -> 'f(-1)').
52 # allow transformation of binary operations ('f -1' -> 'f(-1)').
@@ -58,8 +58,8 b' def test_autocall_binops():'
58 ac.exclude_regexp = r'^[,&^\|\*/]|^is |^not |^in |^and |^or '
58 ac.exclude_regexp = r'^[,&^\|\*/]|^is |^not |^in |^and |^or '
59 pm.sort_checkers()
59 pm.sort_checkers()
60
60
61 yield nt.assert_equals(ip.prefilter('f -1'), 'f(-1)')
61 yield nt.assert_equal(ip.prefilter('f -1'), 'f(-1)')
62 yield nt.assert_equals(ip.prefilter('f +1'), 'f(+1)')
62 yield nt.assert_equal(ip.prefilter('f +1'), 'f(+1)')
63 finally:
63 finally:
64 pm.unregister_checker(ac)
64 pm.unregister_checker(ac)
65 finally:
65 finally:
@@ -81,7 +81,7 b' def test_issue_114():'
81 try:
81 try:
82 for mgk in ip.magics_manager.lsmagic()['line']:
82 for mgk in ip.magics_manager.lsmagic()['line']:
83 raw = template % mgk
83 raw = template % mgk
84 yield nt.assert_equals(ip.prefilter(raw), raw)
84 yield nt.assert_equal(ip.prefilter(raw), raw)
85 finally:
85 finally:
86 ip.prefilter_manager.multi_line_specials = msp
86 ip.prefilter_manager.multi_line_specials = msp
87
87
@@ -141,11 +141,11 b' def test_list_profiles_in():'
141 found_unicode = True
141 found_unicode = True
142 break
142 break
143 nt.assert_true(found_unicode)
143 nt.assert_true(found_unicode)
144 nt.assert_equals(set(profiles), set(['foo', 'hello']))
144 nt.assert_equal(set(profiles), set(['foo', 'hello']))
145
145
146
146
147 def test_list_bundled_profiles():
147 def test_list_bundled_profiles():
148 # This variable will need to be updated when a new profile gets bundled
148 # This variable will need to be updated when a new profile gets bundled
149 bundled_true = [u'cluster', u'math', u'pysh', u'sympy']
149 bundled_true = [u'cluster', u'math', u'pysh', u'sympy']
150 bundled = sorted(list_bundled_profiles())
150 bundled = sorted(list_bundled_profiles())
151 nt.assert_equals(bundled, bundled_true)
151 nt.assert_equal(bundled, bundled_true)
@@ -150,7 +150,7 b' class TestMagicRunPass(tt.TempFileMixin):'
150 self.run_tmpfile()
150 self.run_tmpfile()
151 _ip = get_ipython()
151 _ip = get_ipython()
152 p2 = _ip.prompt_manager.render('in2').strip()
152 p2 = _ip.prompt_manager.render('in2').strip()
153 nt.assert_equals(p2[:3], '...')
153 nt.assert_equal(p2[:3], '...')
154
154
155 def test_run_profile( self ):
155 def test_run_profile( self ):
156 """Test that the option -p, which invokes the profiler, do not
156 """Test that the option -p, which invokes the profiler, do not
@@ -26,14 +26,14 b' def setup():'
26 def test_cython_inline():
26 def test_cython_inline():
27 ip.ex('a=10; b=20')
27 ip.ex('a=10; b=20')
28 result = ip.run_cell_magic('cython_inline','','return a+b')
28 result = ip.run_cell_magic('cython_inline','','return a+b')
29 nt.assert_equals(result, 30)
29 nt.assert_equal(result, 30)
30
30
31
31
32 def test_cython_pyximport():
32 def test_cython_pyximport():
33 module_name = '_test_cython_pyximport'
33 module_name = '_test_cython_pyximport'
34 ip.run_cell_magic('cython_pyximport', module_name, code)
34 ip.run_cell_magic('cython_pyximport', module_name, code)
35 ip.ex('g = f(10)')
35 ip.ex('g = f(10)')
36 nt.assert_equals(ip.user_ns['g'], 20.0)
36 nt.assert_equal(ip.user_ns['g'], 20.0)
37 try:
37 try:
38 os.remove(module_name+'.pyx')
38 os.remove(module_name+'.pyx')
39 except OSError:
39 except OSError:
@@ -43,7 +43,7 b' def test_cython_pyximport():'
43 def test_cython():
43 def test_cython():
44 ip.run_cell_magic('cython', '', code)
44 ip.run_cell_magic('cython', '', code)
45 ip.ex('g = f(10)')
45 ip.ex('g = f(10)')
46 nt.assert_equals(ip.user_ns['g'], 20.0)
46 nt.assert_equal(ip.user_ns['g'], 20.0)
47
47
48
48
49 @dec.skip_win32
49 @dec.skip_win32
@@ -54,5 +54,5 b' x = sin(0.0)'
54 """)
54 """)
55 ip.user_ns['x'] = 1
55 ip.user_ns['x'] = 1
56 ip.run_cell_magic('cython', '-l m', code)
56 ip.run_cell_magic('cython', '-l m', code)
57 nt.assert_equals(ip.user_ns['x'], 0)
57 nt.assert_equal(ip.user_ns['x'], 0)
58
58
@@ -45,12 +45,12 b' def test_console_starts():'
45
45
46 p = pexpect.spawn(ipython_cmd, args=['console', '--colors=NoColor'])
46 p = pexpect.spawn(ipython_cmd, args=['console', '--colors=NoColor'])
47 idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=15)
47 idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=15)
48 nt.assert_equals(idx, 0, "expected in prompt")
48 nt.assert_equal(idx, 0, "expected in prompt")
49 p.sendline('5')
49 p.sendline('5')
50 idx = p.expect([r'Out\[\d+\]: 5', pexpect.EOF], timeout=5)
50 idx = p.expect([r'Out\[\d+\]: 5', pexpect.EOF], timeout=5)
51 nt.assert_equals(idx, 0, "expected out prompt")
51 nt.assert_equal(idx, 0, "expected out prompt")
52 idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=5)
52 idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=5)
53 nt.assert_equals(idx, 0, "expected second in prompt")
53 nt.assert_equal(idx, 0, "expected second in prompt")
54 # send ctrl-D;ctrl-D to exit
54 # send ctrl-D;ctrl-D to exit
55 p.sendeof()
55 p.sendeof()
56 p.sendeof()
56 p.sendeof()
@@ -52,7 +52,7 b' def test_result():'
52 jobs = bg.BackgroundJobManager()
52 jobs = bg.BackgroundJobManager()
53 j = jobs.new(sleeper)
53 j = jobs.new(sleeper)
54 j.join()
54 j.join()
55 nt.assert_equals(j.result['interval'], t_short)
55 nt.assert_equal(j.result['interval'], t_short)
56
56
57
57
58 def test_flush():
58 def test_flush():
@@ -60,10 +60,10 b' def test_flush():'
60 jobs = bg.BackgroundJobManager()
60 jobs = bg.BackgroundJobManager()
61 j = jobs.new(sleeper)
61 j = jobs.new(sleeper)
62 j.join()
62 j.join()
63 nt.assert_equals(len(jobs.completed), 1)
63 nt.assert_equal(len(jobs.completed), 1)
64 nt.assert_equals(len(jobs.dead), 0)
64 nt.assert_equal(len(jobs.dead), 0)
65 jobs.flush()
65 jobs.flush()
66 nt.assert_equals(len(jobs.completed), 0)
66 nt.assert_equal(len(jobs.completed), 0)
67
67
68
68
69 def test_dead():
69 def test_dead():
@@ -71,10 +71,10 b' def test_dead():'
71 jobs = bg.BackgroundJobManager()
71 jobs = bg.BackgroundJobManager()
72 j = jobs.new(crasher)
72 j = jobs.new(crasher)
73 j.join()
73 j.join()
74 nt.assert_equals(len(jobs.completed), 0)
74 nt.assert_equal(len(jobs.completed), 0)
75 nt.assert_equals(len(jobs.dead), 1)
75 nt.assert_equal(len(jobs.dead), 1)
76 jobs.flush()
76 jobs.flush()
77 nt.assert_equals(len(jobs.dead), 0)
77 nt.assert_equal(len(jobs.dead), 0)
78
78
79
79
80 def test_longer():
80 def test_longer():
@@ -84,8 +84,8 b' def test_longer():'
84 # job as running, but not so long that it makes the test suite noticeably
84 # job as running, but not so long that it makes the test suite noticeably
85 # slower.
85 # slower.
86 j = jobs.new(sleeper, 0.1)
86 j = jobs.new(sleeper, 0.1)
87 nt.assert_equals(len(jobs.running), 1)
87 nt.assert_equal(len(jobs.running), 1)
88 nt.assert_equals(len(jobs.completed), 0)
88 nt.assert_equal(len(jobs.completed), 0)
89 j.join()
89 j.join()
90 nt.assert_equals(len(jobs.running), 0)
90 nt.assert_equal(len(jobs.running), 0)
91 nt.assert_equals(len(jobs.completed), 1)
91 nt.assert_equal(len(jobs.completed), 1)
@@ -59,7 +59,7 b' def test_indentation():'
59 gotoutput = pretty.pretty(MyList(range(count)))
59 gotoutput = pretty.pretty(MyList(range(count)))
60 expectedoutput = "MyList(\n" + ",\n".join(" %d" % i for i in range(count)) + ")"
60 expectedoutput = "MyList(\n" + ",\n".join(" %d" % i for i in range(count)) + ")"
61
61
62 nt.assert_equals(gotoutput, expectedoutput)
62 nt.assert_equal(gotoutput, expectedoutput)
63
63
64
64
65 def test_dispatch():
65 def test_dispatch():
@@ -70,7 +70,7 b' def test_dispatch():'
70 gotoutput = pretty.pretty(MyDict())
70 gotoutput = pretty.pretty(MyDict())
71 expectedoutput = "MyDict(...)"
71 expectedoutput = "MyDict(...)"
72
72
73 nt.assert_equals(gotoutput, expectedoutput)
73 nt.assert_equal(gotoutput, expectedoutput)
74
74
75
75
76 def test_callability_checking():
76 def test_callability_checking():
@@ -81,4 +81,4 b' def test_callability_checking():'
81 gotoutput = pretty.pretty(Dummy2())
81 gotoutput = pretty.pretty(Dummy2())
82 expectedoutput = "Dummy1(...)"
82 expectedoutput = "Dummy1(...)"
83
83
84 nt.assert_equals(gotoutput, expectedoutput)
84 nt.assert_equal(gotoutput, expectedoutput)
@@ -5,17 +5,17 b' import nose.tools as nt'
5 def test_passwd_structure():
5 def test_passwd_structure():
6 p = passwd('passphrase')
6 p = passwd('passphrase')
7 algorithm, salt, hashed = p.split(':')
7 algorithm, salt, hashed = p.split(':')
8 nt.assert_equals(algorithm, 'sha1')
8 nt.assert_equal(algorithm, 'sha1')
9 nt.assert_equals(len(salt), salt_len)
9 nt.assert_equal(len(salt), salt_len)
10 nt.assert_equals(len(hashed), 40)
10 nt.assert_equal(len(hashed), 40)
11
11
12 def test_roundtrip():
12 def test_roundtrip():
13 p = passwd('passphrase')
13 p = passwd('passphrase')
14 nt.assert_equals(passwd_check(p, 'passphrase'), True)
14 nt.assert_equal(passwd_check(p, 'passphrase'), True)
15
15
16 def test_bad():
16 def test_bad():
17 p = passwd('passphrase')
17 p = passwd('passphrase')
18 nt.assert_equals(passwd_check(p, p), False)
18 nt.assert_equal(passwd_check(p, p), False)
19 nt.assert_equals(passwd_check(p, 'a:b:c:d'), False)
19 nt.assert_equal(passwd_check(p, 'a:b:c:d'), False)
20 nt.assert_equals(passwd_check(p, 'a:b'), False)
20 nt.assert_equal(passwd_check(p, 'a:b'), False)
21
21
@@ -256,12 +256,12 b" def ipexec_validate(fname, expected_out, expected_err='',"
256 # more informative than simply having an empty stdout.
256 # more informative than simply having an empty stdout.
257 if err:
257 if err:
258 if expected_err:
258 if expected_err:
259 nt.assert_equals(err.strip(), expected_err.strip())
259 nt.assert_equal(err.strip(), expected_err.strip())
260 else:
260 else:
261 raise ValueError('Running file %r produced error: %r' %
261 raise ValueError('Running file %r produced error: %r' %
262 (fname, err))
262 (fname, err))
263 # If no errors or output on stderr was expected, match stdout
263 # If no errors or output on stderr was expected, match stdout
264 nt.assert_equals(out.strip(), expected_out.strip())
264 nt.assert_equal(out.strip(), expected_out.strip())
265
265
266
266
267 class TempFileMixin(object):
267 class TempFileMixin(object):
@@ -52,7 +52,7 b' class TeeTestCase(dec.ParametricTestCase):'
52 print(text, end='', file=chan)
52 print(text, end='', file=chan)
53 setattr(sys, channel, std_ori)
53 setattr(sys, channel, std_ori)
54 trap_val = trap.getvalue()
54 trap_val = trap.getvalue()
55 nt.assert_equals(chan.getvalue(), text)
55 nt.assert_equal(chan.getvalue(), text)
56 if check=='close':
56 if check=='close':
57 tee.close()
57 tee.close()
58 else:
58 else:
@@ -82,5 +82,5 b' def test_capture_output():'
82 print('hi, stdout')
82 print('hi, stdout')
83 print('hi, stderr', file=sys.stderr)
83 print('hi, stderr', file=sys.stderr)
84
84
85 nt.assert_equals(io.stdout, 'hi, stdout\n')
85 nt.assert_equal(io.stdout, 'hi, stdout\n')
86 nt.assert_equals(io.stderr, 'hi, stderr\n')
86 nt.assert_equal(io.stderr, 'hi, stderr\n')
@@ -373,13 +373,13 b' def test_get_ipython_module_path():'
373 @dec.skip_if_not_win32
373 @dec.skip_if_not_win32
374 def test_get_long_path_name_win32():
374 def test_get_long_path_name_win32():
375 p = path.get_long_path_name('c:\\docume~1')
375 p = path.get_long_path_name('c:\\docume~1')
376 nt.assert_equals(p,u'c:\\Documents and Settings')
376 nt.assert_equal(p,u'c:\\Documents and Settings')
377
377
378
378
379 @dec.skip_win32
379 @dec.skip_win32
380 def test_get_long_path_name():
380 def test_get_long_path_name():
381 p = path.get_long_path_name('/usr/local')
381 p = path.get_long_path_name('/usr/local')
382 nt.assert_equals(p,'/usr/local')
382 nt.assert_equal(p,'/usr/local')
383
383
384 @dec.skip_win32 # can't create not-user-writable dir on win
384 @dec.skip_win32 # can't create not-user-writable dir on win
385 @with_environment
385 @with_environment
@@ -399,36 +399,36 b' def test_not_writable_ipdir():'
399
399
400 def test_unquote_filename():
400 def test_unquote_filename():
401 for win32 in (True, False):
401 for win32 in (True, False):
402 nt.assert_equals(path.unquote_filename('foo.py', win32=win32), 'foo.py')
402 nt.assert_equal(path.unquote_filename('foo.py', win32=win32), 'foo.py')
403 nt.assert_equals(path.unquote_filename('foo bar.py', win32=win32), 'foo bar.py')
403 nt.assert_equal(path.unquote_filename('foo bar.py', win32=win32), 'foo bar.py')
404 nt.assert_equals(path.unquote_filename('"foo.py"', win32=True), 'foo.py')
404 nt.assert_equal(path.unquote_filename('"foo.py"', win32=True), 'foo.py')
405 nt.assert_equals(path.unquote_filename('"foo bar.py"', win32=True), 'foo bar.py')
405 nt.assert_equal(path.unquote_filename('"foo bar.py"', win32=True), 'foo bar.py')
406 nt.assert_equals(path.unquote_filename("'foo.py'", win32=True), 'foo.py')
406 nt.assert_equal(path.unquote_filename("'foo.py'", win32=True), 'foo.py')
407 nt.assert_equals(path.unquote_filename("'foo bar.py'", win32=True), 'foo bar.py')
407 nt.assert_equal(path.unquote_filename("'foo bar.py'", win32=True), 'foo bar.py')
408 nt.assert_equals(path.unquote_filename('"foo.py"', win32=False), '"foo.py"')
408 nt.assert_equal(path.unquote_filename('"foo.py"', win32=False), '"foo.py"')
409 nt.assert_equals(path.unquote_filename('"foo bar.py"', win32=False), '"foo bar.py"')
409 nt.assert_equal(path.unquote_filename('"foo bar.py"', win32=False), '"foo bar.py"')
410 nt.assert_equals(path.unquote_filename("'foo.py'", win32=False), "'foo.py'")
410 nt.assert_equal(path.unquote_filename("'foo.py'", win32=False), "'foo.py'")
411 nt.assert_equals(path.unquote_filename("'foo bar.py'", win32=False), "'foo bar.py'")
411 nt.assert_equal(path.unquote_filename("'foo bar.py'", win32=False), "'foo bar.py'")
412
412
413 @with_environment
413 @with_environment
414 def test_get_py_filename():
414 def test_get_py_filename():
415 os.chdir(TMP_TEST_DIR)
415 os.chdir(TMP_TEST_DIR)
416 for win32 in (True, False):
416 for win32 in (True, False):
417 with make_tempfile('foo.py'):
417 with make_tempfile('foo.py'):
418 nt.assert_equals(path.get_py_filename('foo.py', force_win32=win32), 'foo.py')
418 nt.assert_equal(path.get_py_filename('foo.py', force_win32=win32), 'foo.py')
419 nt.assert_equals(path.get_py_filename('foo', force_win32=win32), 'foo.py')
419 nt.assert_equal(path.get_py_filename('foo', force_win32=win32), 'foo.py')
420 with make_tempfile('foo'):
420 with make_tempfile('foo'):
421 nt.assert_equals(path.get_py_filename('foo', force_win32=win32), 'foo')
421 nt.assert_equal(path.get_py_filename('foo', force_win32=win32), 'foo')
422 nt.assert_raises(IOError, path.get_py_filename, 'foo.py', force_win32=win32)
422 nt.assert_raises(IOError, path.get_py_filename, 'foo.py', force_win32=win32)
423 nt.assert_raises(IOError, path.get_py_filename, 'foo', force_win32=win32)
423 nt.assert_raises(IOError, path.get_py_filename, 'foo', force_win32=win32)
424 nt.assert_raises(IOError, path.get_py_filename, 'foo.py', force_win32=win32)
424 nt.assert_raises(IOError, path.get_py_filename, 'foo.py', force_win32=win32)
425 true_fn = 'foo with spaces.py'
425 true_fn = 'foo with spaces.py'
426 with make_tempfile(true_fn):
426 with make_tempfile(true_fn):
427 nt.assert_equals(path.get_py_filename('foo with spaces', force_win32=win32), true_fn)
427 nt.assert_equal(path.get_py_filename('foo with spaces', force_win32=win32), true_fn)
428 nt.assert_equals(path.get_py_filename('foo with spaces.py', force_win32=win32), true_fn)
428 nt.assert_equal(path.get_py_filename('foo with spaces.py', force_win32=win32), true_fn)
429 if win32:
429 if win32:
430 nt.assert_equals(path.get_py_filename('"foo with spaces.py"', force_win32=True), true_fn)
430 nt.assert_equal(path.get_py_filename('"foo with spaces.py"', force_win32=True), true_fn)
431 nt.assert_equals(path.get_py_filename("'foo with spaces.py'", force_win32=True), true_fn)
431 nt.assert_equal(path.get_py_filename("'foo with spaces.py'", force_win32=True), true_fn)
432 else:
432 else:
433 nt.assert_raises(IOError, path.get_py_filename, '"foo with spaces.py"', force_win32=False)
433 nt.assert_raises(IOError, path.get_py_filename, '"foo with spaces.py"', force_win32=False)
434 nt.assert_raises(IOError, path.get_py_filename, "'foo with spaces.py'", force_win32=False)
434 nt.assert_raises(IOError, path.get_py_filename, "'foo with spaces.py'", force_win32=False)
@@ -30,7 +30,7 b' from IPython.testing import tools as tt'
30
30
31 def test_find_cmd_python():
31 def test_find_cmd_python():
32 """Make sure we find sys.exectable for python."""
32 """Make sure we find sys.exectable for python."""
33 nt.assert_equals(find_cmd('python'), sys.executable)
33 nt.assert_equal(find_cmd('python'), sys.executable)
34
34
35
35
36 @dec.skip_win32
36 @dec.skip_win32
@@ -30,5 +30,5 b' def test_unicode_colorize():'
30 p = Parser()
30 p = Parser()
31 f1 = p.format('1/0', 'str')
31 f1 = p.format('1/0', 'str')
32 f2 = p.format(u'1/0', 'str')
32 f2 = p.format(u'1/0', 'str')
33 nt.assert_equals(f1, f2)
33 nt.assert_equal(f1, f2)
34
34
@@ -32,11 +32,11 b' def test_columnize():'
32 size = 5
32 size = 5
33 items = [l*size for l in 'abc']
33 items = [l*size for l in 'abc']
34 out = text.columnize(items, displaywidth=80)
34 out = text.columnize(items, displaywidth=80)
35 nt.assert_equals(out, 'aaaaa bbbbb ccccc\n')
35 nt.assert_equal(out, 'aaaaa bbbbb ccccc\n')
36 out = text.columnize(items, displaywidth=12)
36 out = text.columnize(items, displaywidth=12)
37 nt.assert_equals(out, 'aaaaa ccccc\nbbbbb\n')
37 nt.assert_equal(out, 'aaaaa ccccc\nbbbbb\n')
38 out = text.columnize(items, displaywidth=10)
38 out = text.columnize(items, displaywidth=10)
39 nt.assert_equals(out, 'aaaaa\nbbbbb\nccccc\n')
39 nt.assert_equal(out, 'aaaaa\nbbbbb\nccccc\n')
40
40
41 def test_columnize_random():
41 def test_columnize_random():
42 """Test with random input to hopfully catch edge case """
42 """Test with random input to hopfully catch edge case """
@@ -60,31 +60,31 b' def test_columnize_medium():'
60 size = 40
60 size = 40
61 items = [l*size for l in 'abc']
61 items = [l*size for l in 'abc']
62 out = text.columnize(items, displaywidth=80)
62 out = text.columnize(items, displaywidth=80)
63 nt.assert_equals(out, '\n'.join(items+['']))
63 nt.assert_equal(out, '\n'.join(items+['']))
64
64
65 def test_columnize_long():
65 def test_columnize_long():
66 """Test columnize with inputs longer than the display window"""
66 """Test columnize with inputs longer than the display window"""
67 size = 11
67 size = 11
68 items = [l*size for l in 'abc']
68 items = [l*size for l in 'abc']
69 out = text.columnize(items, displaywidth=size-1)
69 out = text.columnize(items, displaywidth=size-1)
70 nt.assert_equals(out, '\n'.join(items+['']))
70 nt.assert_equal(out, '\n'.join(items+['']))
71
71
72 def eval_formatter_check(f):
72 def eval_formatter_check(f):
73 ns = dict(n=12, pi=math.pi, stuff='hello there', os=os, u=u"cafΓ©", b="cafΓ©")
73 ns = dict(n=12, pi=math.pi, stuff='hello there', os=os, u=u"cafΓ©", b="cafΓ©")
74 s = f.format("{n} {n//4} {stuff.split()[0]}", **ns)
74 s = f.format("{n} {n//4} {stuff.split()[0]}", **ns)
75 nt.assert_equals(s, "12 3 hello")
75 nt.assert_equal(s, "12 3 hello")
76 s = f.format(' '.join(['{n//%i}'%i for i in range(1,8)]), **ns)
76 s = f.format(' '.join(['{n//%i}'%i for i in range(1,8)]), **ns)
77 nt.assert_equals(s, "12 6 4 3 2 2 1")
77 nt.assert_equal(s, "12 6 4 3 2 2 1")
78 s = f.format('{[n//i for i in range(1,8)]}', **ns)
78 s = f.format('{[n//i for i in range(1,8)]}', **ns)
79 nt.assert_equals(s, "[12, 6, 4, 3, 2, 2, 1]")
79 nt.assert_equal(s, "[12, 6, 4, 3, 2, 2, 1]")
80 s = f.format("{stuff!s}", **ns)
80 s = f.format("{stuff!s}", **ns)
81 nt.assert_equals(s, ns['stuff'])
81 nt.assert_equal(s, ns['stuff'])
82 s = f.format("{stuff!r}", **ns)
82 s = f.format("{stuff!r}", **ns)
83 nt.assert_equals(s, repr(ns['stuff']))
83 nt.assert_equal(s, repr(ns['stuff']))
84
84
85 # Check with unicode:
85 # Check with unicode:
86 s = f.format("{u}", **ns)
86 s = f.format("{u}", **ns)
87 nt.assert_equals(s, ns['u'])
87 nt.assert_equal(s, ns['u'])
88 # This decodes in a platform dependent manner, but it shouldn't error out
88 # This decodes in a platform dependent manner, but it shouldn't error out
89 s = f.format("{b}", **ns)
89 s = f.format("{b}", **ns)
90
90
@@ -93,11 +93,11 b' def eval_formatter_check(f):'
93 def eval_formatter_slicing_check(f):
93 def eval_formatter_slicing_check(f):
94 ns = dict(n=12, pi=math.pi, stuff='hello there', os=os)
94 ns = dict(n=12, pi=math.pi, stuff='hello there', os=os)
95 s = f.format(" {stuff.split()[:]} ", **ns)
95 s = f.format(" {stuff.split()[:]} ", **ns)
96 nt.assert_equals(s, " ['hello', 'there'] ")
96 nt.assert_equal(s, " ['hello', 'there'] ")
97 s = f.format(" {stuff.split()[::-1]} ", **ns)
97 s = f.format(" {stuff.split()[::-1]} ", **ns)
98 nt.assert_equals(s, " ['there', 'hello'] ")
98 nt.assert_equal(s, " ['there', 'hello'] ")
99 s = f.format("{stuff[::2]}", **ns)
99 s = f.format("{stuff[::2]}", **ns)
100 nt.assert_equals(s, ns['stuff'][::2])
100 nt.assert_equal(s, ns['stuff'][::2])
101
101
102 nt.assert_raises(SyntaxError, f.format, "{n:x}", **ns)
102 nt.assert_raises(SyntaxError, f.format, "{n:x}", **ns)
103
103
@@ -105,10 +105,10 b' def eval_formatter_no_slicing_check(f):'
105 ns = dict(n=12, pi=math.pi, stuff='hello there', os=os)
105 ns = dict(n=12, pi=math.pi, stuff='hello there', os=os)
106
106
107 s = f.format('{n:x} {pi**2:+f}', **ns)
107 s = f.format('{n:x} {pi**2:+f}', **ns)
108 nt.assert_equals(s, "c +9.869604")
108 nt.assert_equal(s, "c +9.869604")
109
109
110 s = f.format('{stuff[slice(1,4)]}', **ns)
110 s = f.format('{stuff[slice(1,4)]}', **ns)
111 nt.assert_equals(s, 'ell')
111 nt.assert_equal(s, 'ell')
112
112
113 nt.assert_raises(SyntaxError, f.format, "{a[:]}")
113 nt.assert_raises(SyntaxError, f.format, "{a[:]}")
114
114
@@ -129,25 +129,25 b' def test_dollar_formatter():'
129
129
130 ns = dict(n=12, pi=math.pi, stuff='hello there', os=os)
130 ns = dict(n=12, pi=math.pi, stuff='hello there', os=os)
131 s = f.format("$n", **ns)
131 s = f.format("$n", **ns)
132 nt.assert_equals(s, "12")
132 nt.assert_equal(s, "12")
133 s = f.format("$n.real", **ns)
133 s = f.format("$n.real", **ns)
134 nt.assert_equals(s, "12")
134 nt.assert_equal(s, "12")
135 s = f.format("$n/{stuff[:5]}", **ns)
135 s = f.format("$n/{stuff[:5]}", **ns)
136 nt.assert_equals(s, "12/hello")
136 nt.assert_equal(s, "12/hello")
137 s = f.format("$n $$HOME", **ns)
137 s = f.format("$n $$HOME", **ns)
138 nt.assert_equals(s, "12 $HOME")
138 nt.assert_equal(s, "12 $HOME")
139 s = f.format("${foo}", foo="HOME")
139 s = f.format("${foo}", foo="HOME")
140 nt.assert_equals(s, "$HOME")
140 nt.assert_equal(s, "$HOME")
141
141
142
142
143 def test_long_substr():
143 def test_long_substr():
144 data = ['hi']
144 data = ['hi']
145 nt.assert_equals(text.long_substr(data), 'hi')
145 nt.assert_equal(text.long_substr(data), 'hi')
146
146
147
147
148 def test_long_substr2():
148 def test_long_substr2():
149 data = ['abc', 'abd', 'abf', 'ab']
149 data = ['abc', 'abd', 'abf', 'ab']
150 nt.assert_equals(text.long_substr(data), 'ab')
150 nt.assert_equal(text.long_substr(data), 'ab')
151
151
152
152
153 def test_strip_email():
153 def test_strip_email():
@@ -161,10 +161,10 b' def test_strip_email():'
161 ... return x+1
161 ... return x+1
162 ...
162 ...
163 >>> zz = f(2.5)"""
163 >>> zz = f(2.5)"""
164 nt.assert_equals(text.strip_email_quotes(src), cln)
164 nt.assert_equal(text.strip_email_quotes(src), cln)
165
165
166
166
167 def test_strip_email2():
167 def test_strip_email2():
168 src = '> > > list()'
168 src = '> > > list()'
169 cln = 'list()'
169 cln = 'list()'
170 nt.assert_equals(text.strip_email_quotes(src), cln)
170 nt.assert_equal(text.strip_email_quotes(src), cln)
@@ -117,14 +117,14 b' def test_embed_kernel_basic():'
117 msg_id = shell.execute("c=a*2")
117 msg_id = shell.execute("c=a*2")
118 msg = shell.get_msg(block=True, timeout=2)
118 msg = shell.get_msg(block=True, timeout=2)
119 content = msg['content']
119 content = msg['content']
120 nt.assert_equals(content['status'], u'ok')
120 nt.assert_equal(content['status'], u'ok')
121
121
122 # oinfo c (should be 10)
122 # oinfo c (should be 10)
123 msg_id = shell.object_info('c')
123 msg_id = shell.object_info('c')
124 msg = shell.get_msg(block=True, timeout=2)
124 msg = shell.get_msg(block=True, timeout=2)
125 content = msg['content']
125 content = msg['content']
126 nt.assert_true(content['found'])
126 nt.assert_true(content['found'])
127 nt.assert_equals(content['string_form'], u'10')
127 nt.assert_equal(content['string_form'], u'10')
128
128
129 def test_embed_kernel_namespace():
129 def test_embed_kernel_namespace():
130 """IPython.embed_kernel() inherits calling namespace"""
130 """IPython.embed_kernel() inherits calling namespace"""
@@ -146,14 +146,14 b' def test_embed_kernel_namespace():'
146 msg = shell.get_msg(block=True, timeout=2)
146 msg = shell.get_msg(block=True, timeout=2)
147 content = msg['content']
147 content = msg['content']
148 nt.assert_true(content['found'])
148 nt.assert_true(content['found'])
149 nt.assert_equals(content['string_form'], u'5')
149 nt.assert_equal(content['string_form'], u'5')
150
150
151 # oinfo b (str)
151 # oinfo b (str)
152 msg_id = shell.object_info('b')
152 msg_id = shell.object_info('b')
153 msg = shell.get_msg(block=True, timeout=2)
153 msg = shell.get_msg(block=True, timeout=2)
154 content = msg['content']
154 content = msg['content']
155 nt.assert_true(content['found'])
155 nt.assert_true(content['found'])
156 nt.assert_equals(content['string_form'], u'hi there')
156 nt.assert_equal(content['string_form'], u'hi there')
157
157
158 # oinfo c (undefined)
158 # oinfo c (undefined)
159 msg_id = shell.object_info('c')
159 msg_id = shell.object_info('c')
@@ -183,7 +183,7 b' def test_embed_kernel_reentrant():'
183 msg = shell.get_msg(block=True, timeout=2)
183 msg = shell.get_msg(block=True, timeout=2)
184 content = msg['content']
184 content = msg['content']
185 nt.assert_true(content['found'])
185 nt.assert_true(content['found'])
186 nt.assert_equals(content['string_form'], unicode(i))
186 nt.assert_equal(content['string_form'], unicode(i))
187
187
188 # exit from embed_kernel
188 # exit from embed_kernel
189 shell.execute("get_ipython().exit_now = True")
189 shell.execute("get_ipython().exit_now = True")
@@ -68,12 +68,12 b" def execute(code='', **kwargs):"
68 list(validate_message(reply, 'execute_reply', msg_id))
68 list(validate_message(reply, 'execute_reply', msg_id))
69 busy = sub.get_msg(timeout=2)
69 busy = sub.get_msg(timeout=2)
70 list(validate_message(busy, 'status', msg_id))
70 list(validate_message(busy, 'status', msg_id))
71 nt.assert_equals(busy['content']['execution_state'], 'busy')
71 nt.assert_equal(busy['content']['execution_state'], 'busy')
72
72
73 if not kwargs.get('silent'):
73 if not kwargs.get('silent'):
74 pyin = sub.get_msg(timeout=2)
74 pyin = sub.get_msg(timeout=2)
75 list(validate_message(pyin, 'pyin', msg_id))
75 list(validate_message(pyin, 'pyin', msg_id))
76 nt.assert_equals(pyin['content']['code'], code)
76 nt.assert_equal(pyin['content']['code'], code)
77
77
78 return msg_id, reply['content']
78 return msg_id, reply['content']
79
79
@@ -245,7 +245,7 b' def validate_message(msg, msg_type=None, parent=None):'
245 """
245 """
246 RMessage().check(msg)
246 RMessage().check(msg)
247 if msg_type:
247 if msg_type:
248 yield nt.assert_equals(msg['msg_type'], msg_type)
248 yield nt.assert_equal(msg['msg_type'], msg_type)
249 if parent:
249 if parent:
250 yield nt.assert_equal(msg['parent_header']['msg_id'], parent)
250 yield nt.assert_equal(msg['parent_header']['msg_id'], parent)
251 content = msg['content']
251 content = msg['content']
@@ -280,7 +280,7 b' def test_execute_silent():'
280 status = KM.sub_channel.get_msg(timeout=2)
280 status = KM.sub_channel.get_msg(timeout=2)
281 for tst in validate_message(status, 'status', msg_id):
281 for tst in validate_message(status, 'status', msg_id):
282 yield tst
282 yield tst
283 nt.assert_equals(status['content']['execution_state'], 'idle')
283 nt.assert_equal(status['content']['execution_state'], 'idle')
284
284
285 yield nt.assert_raises(Empty, KM.sub_channel.get_msg, timeout=0.1)
285 yield nt.assert_raises(Empty, KM.sub_channel.get_msg, timeout=0.1)
286 count = reply['execution_count']
286 count = reply['execution_count']
@@ -291,11 +291,11 b' def test_execute_silent():'
291 status = KM.sub_channel.get_msg(timeout=2)
291 status = KM.sub_channel.get_msg(timeout=2)
292 for tst in validate_message(status, 'status', msg_id):
292 for tst in validate_message(status, 'status', msg_id):
293 yield tst
293 yield tst
294 yield nt.assert_equals(status['content']['execution_state'], 'idle')
294 yield nt.assert_equal(status['content']['execution_state'], 'idle')
295
295
296 yield nt.assert_raises(Empty, KM.sub_channel.get_msg, timeout=0.1)
296 yield nt.assert_raises(Empty, KM.sub_channel.get_msg, timeout=0.1)
297 count_2 = reply['execution_count']
297 count_2 = reply['execution_count']
298 yield nt.assert_equals(count_2, count)
298 yield nt.assert_equal(count_2, count)
299
299
300
300
301 @dec.parametric
301 @dec.parametric
@@ -303,8 +303,8 b' def test_execute_error():'
303 flush_channels()
303 flush_channels()
304
304
305 msg_id, reply = execute(code='1/0')
305 msg_id, reply = execute(code='1/0')
306 yield nt.assert_equals(reply['status'], 'error')
306 yield nt.assert_equal(reply['status'], 'error')
307 yield nt.assert_equals(reply['ename'], 'ZeroDivisionError')
307 yield nt.assert_equal(reply['ename'], 'ZeroDivisionError')
308
308
309 pyerr = KM.sub_channel.get_msg(timeout=2)
309 pyerr = KM.sub_channel.get_msg(timeout=2)
310 for tst in validate_message(pyerr, 'pyerr', msg_id):
310 for tst in validate_message(pyerr, 'pyerr', msg_id):
@@ -322,7 +322,7 b' def test_execute_inc():'
322
322
323 msg_id, reply = execute(code='x=2')
323 msg_id, reply = execute(code='x=2')
324 count_2 = reply['execution_count']
324 count_2 = reply['execution_count']
325 nt.assert_equals(count_2, count+1)
325 nt.assert_equal(count_2, count+1)
326
326
327
327
328 def test_user_variables():
328 def test_user_variables():
@@ -330,7 +330,7 b' def test_user_variables():'
330
330
331 msg_id, reply = execute(code='x=1', user_variables=['x'])
331 msg_id, reply = execute(code='x=1', user_variables=['x'])
332 user_variables = reply['user_variables']
332 user_variables = reply['user_variables']
333 nt.assert_equals(user_variables, {u'x' : u'1'})
333 nt.assert_equal(user_variables, {u'x' : u'1'})
334
334
335
335
336 def test_user_expressions():
336 def test_user_expressions():
@@ -338,7 +338,7 b' def test_user_expressions():'
338
338
339 msg_id, reply = execute(code='x=1', user_expressions=dict(foo='x+1'))
339 msg_id, reply = execute(code='x=1', user_expressions=dict(foo='x+1'))
340 user_expressions = reply['user_expressions']
340 user_expressions = reply['user_expressions']
341 nt.assert_equals(user_expressions, {u'foo' : u'2'})
341 nt.assert_equal(user_expressions, {u'foo' : u'2'})
342
342
343
343
344 @dec.parametric
344 @dec.parametric
@@ -387,7 +387,7 b' def test_oinfo_detail():'
387 yield nt.assert_true(content['found'])
387 yield nt.assert_true(content['found'])
388 argspec = content['argspec']
388 argspec = content['argspec']
389 yield nt.assert_true(isinstance(argspec, dict), "expected non-empty argspec dict, got %r" % argspec)
389 yield nt.assert_true(isinstance(argspec, dict), "expected non-empty argspec dict, got %r" % argspec)
390 yield nt.assert_equals(argspec['defaults'], [0])
390 yield nt.assert_equal(argspec['defaults'], [0])
391
391
392
392
393 @dec.parametric
393 @dec.parametric
@@ -434,8 +434,8 b' def test_stream():'
434 for tst in validate_message(stdout, 'stream', msg_id):
434 for tst in validate_message(stdout, 'stream', msg_id):
435 yield tst
435 yield tst
436 content = stdout['content']
436 content = stdout['content']
437 yield nt.assert_equals(content['name'], u'stdout')
437 yield nt.assert_equal(content['name'], u'stdout')
438 yield nt.assert_equals(content['data'], u'hi\n')
438 yield nt.assert_equal(content['data'], u'hi\n')
439
439
440
440
441 @dec.parametric
441 @dec.parametric
@@ -448,5 +448,5 b' def test_display_data():'
448 for tst in validate_message(display, 'display_data', parent=msg_id):
448 for tst in validate_message(display, 'display_data', parent=msg_id):
449 yield tst
449 yield tst
450 data = display['content']['data']
450 data = display['content']['data']
451 yield nt.assert_equals(data['text/plain'], u'1')
451 yield nt.assert_equal(data['text/plain'], u'1')
452
452
General Comments 0
You need to be logged in to leave comments. Login now