##// END OF EJS Templates
Stop duplicating `nt.assert*` in `IPython.testing.tools`.
Bradley M. Froehle -
Show More
@@ -484,7 +484,7 b' def test_extension():'
484 484 _ip.user_ns.pop('arq', None)
485 485 invalidate_caches() # Clear import caches
486 486 _ip.magic("load_ext daft_extension")
487 tt.assert_equal(_ip.user_ns['arq'], 185)
487 nt.assert_equal(_ip.user_ns['arq'], 185)
488 488 _ip.magic("unload_ext daft_extension")
489 489 assert 'arq' not in _ip.user_ns
490 490 finally:
@@ -132,7 +132,7 b' class TestMagicRunPass(tt.TempFileMixin):'
132 132 bid1 = id(_ip.user_ns['__builtins__'])
133 133 self.run_tmpfile()
134 134 bid2 = id(_ip.user_ns['__builtins__'])
135 tt.assert_equals(bid1, bid2)
135 nt.assert_equal(bid1, bid2)
136 136
137 137 def test_builtins_type(self):
138 138 """Check that the type of __builtins__ doesn't change with %run.
@@ -143,7 +143,7 b' class TestMagicRunPass(tt.TempFileMixin):'
143 143 """
144 144 _ip = get_ipython()
145 145 self.run_tmpfile()
146 tt.assert_equals(type(_ip.user_ns['__builtins__']),type(sys))
146 nt.assert_equal(type(_ip.user_ns['__builtins__']),type(sys))
147 147
148 148 def test_prompts(self):
149 149 """Test that prompts correctly generate after %run"""
@@ -206,7 +206,7 b' class TestMagicRunSimple(tt.TempFileMixin):'
206 206 self.mktmp(py3compat.doctest_refactor_print(src))
207 207 _ip.magic('run %s' % self.fname)
208 208 _ip.run_cell('ip == get_ipython()')
209 tt.assert_equals(_ip.user_ns['i'], 5)
209 nt.assert_equal(_ip.user_ns['i'], 5)
210 210
211 211 @dec.skip_win32
212 212 def test_tclass(self):
@@ -236,15 +236,15 b' tclass.py: deleting object: C-third'
236 236 self.mktmp(src)
237 237 _ip.run_cell("zz = 23")
238 238 _ip.magic('run -i %s' % self.fname)
239 tt.assert_equals(_ip.user_ns['yy'], 23)
239 nt.assert_equal(_ip.user_ns['yy'], 23)
240 240 _ip.magic('reset -f')
241 241 _ip.run_cell("zz = 23")
242 242 _ip.magic('run -i %s' % self.fname)
243 tt.assert_equals(_ip.user_ns['yy'], 23)
243 nt.assert_equal(_ip.user_ns['yy'], 23)
244 244
245 245 def test_unicode(self):
246 246 """Check that files in odd encodings are accepted."""
247 247 mydir = os.path.dirname(__file__)
248 248 na = os.path.join(mydir, 'nonascii.py')
249 249 _ip.magic('run "%s"' % na)
250 tt.assert_equals(_ip.user_ns['u'], u'Ўт№Ф')
250 nt.assert_equal(_ip.user_ns['u'], u'Ўт№Ф')
@@ -1,10 +1,5 b''
1 1 """Generic testing tools.
2 2
3 In particular, this module exposes a set of top-level assert* functions that
4 can be used in place of nose.tools.assert* in method generators (the ones in
5 nose can not, at least as of nose 0.10.4).
6
7
8 3 Authors
9 4 -------
10 5 - Fernando Perez <Fernando.Perez@berkeley.edu>
@@ -51,22 +46,6 b' from . import decorators as dec'
51 46 from . import skipdoctest
52 47
53 48 #-----------------------------------------------------------------------------
54 # Globals
55 #-----------------------------------------------------------------------------
56
57 # Make a bunch of nose.tools assert wrappers that can be used in test
58 # generators. This will expose an assert* function for each one in nose.tools.
59
60 _tpl = """
61 def %(name)s(*a,**kw):
62 return nt.%(name)s(*a,**kw)
63 """
64
65 if has_nose:
66 for _x in [a for a in dir(nt) if a.startswith('assert')]:
67 exec _tpl % dict(name=_x)
68
69 #-----------------------------------------------------------------------------
70 49 # Functions and classes
71 50 #-----------------------------------------------------------------------------
72 51
General Comments 0
You need to be logged in to leave comments. Login now