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