From 07ea078898e3508cdac02a07a31731519011041a 2012-07-17 15:30:53 From: Bradley M. Froehle Date: 2012-07-17 15:30:53 Subject: [PATCH] Stop duplicating `nt.assert*` in `IPython.testing.tools`. --- diff --git a/IPython/core/tests/test_magic.py b/IPython/core/tests/test_magic.py index 33ebd9d..4536e5f 100644 --- a/IPython/core/tests/test_magic.py +++ b/IPython/core/tests/test_magic.py @@ -484,7 +484,7 @@ def test_extension(): _ip.user_ns.pop('arq', None) invalidate_caches() # Clear import caches _ip.magic("load_ext daft_extension") - tt.assert_equal(_ip.user_ns['arq'], 185) + nt.assert_equal(_ip.user_ns['arq'], 185) _ip.magic("unload_ext daft_extension") assert 'arq' not in _ip.user_ns finally: diff --git a/IPython/core/tests/test_run.py b/IPython/core/tests/test_run.py index a508885..26558fe 100644 --- a/IPython/core/tests/test_run.py +++ b/IPython/core/tests/test_run.py @@ -132,7 +132,7 @@ class TestMagicRunPass(tt.TempFileMixin): bid1 = id(_ip.user_ns['__builtins__']) self.run_tmpfile() bid2 = id(_ip.user_ns['__builtins__']) - tt.assert_equals(bid1, bid2) + nt.assert_equal(bid1, bid2) def test_builtins_type(self): """Check that the type of __builtins__ doesn't change with %run. @@ -143,7 +143,7 @@ class TestMagicRunPass(tt.TempFileMixin): """ _ip = get_ipython() self.run_tmpfile() - tt.assert_equals(type(_ip.user_ns['__builtins__']),type(sys)) + nt.assert_equal(type(_ip.user_ns['__builtins__']),type(sys)) def test_prompts(self): """Test that prompts correctly generate after %run""" @@ -206,7 +206,7 @@ class TestMagicRunSimple(tt.TempFileMixin): self.mktmp(py3compat.doctest_refactor_print(src)) _ip.magic('run %s' % self.fname) _ip.run_cell('ip == get_ipython()') - tt.assert_equals(_ip.user_ns['i'], 5) + nt.assert_equal(_ip.user_ns['i'], 5) @dec.skip_win32 def test_tclass(self): @@ -236,15 +236,15 @@ tclass.py: deleting object: C-third self.mktmp(src) _ip.run_cell("zz = 23") _ip.magic('run -i %s' % self.fname) - tt.assert_equals(_ip.user_ns['yy'], 23) + nt.assert_equal(_ip.user_ns['yy'], 23) _ip.magic('reset -f') _ip.run_cell("zz = 23") _ip.magic('run -i %s' % self.fname) - tt.assert_equals(_ip.user_ns['yy'], 23) + nt.assert_equal(_ip.user_ns['yy'], 23) def test_unicode(self): """Check that files in odd encodings are accepted.""" mydir = os.path.dirname(__file__) na = os.path.join(mydir, 'nonascii.py') _ip.magic('run "%s"' % na) - tt.assert_equals(_ip.user_ns['u'], u'Ўт№Ф') + nt.assert_equal(_ip.user_ns['u'], u'Ўт№Ф') diff --git a/IPython/testing/tools.py b/IPython/testing/tools.py index e9b061a..a104035 100644 --- a/IPython/testing/tools.py +++ b/IPython/testing/tools.py @@ -1,10 +1,5 @@ """Generic testing tools. -In particular, this module exposes a set of top-level assert* functions that -can be used in place of nose.tools.assert* in method generators (the ones in -nose can not, at least as of nose 0.10.4). - - Authors ------- - Fernando Perez @@ -51,22 +46,6 @@ from . import decorators as dec from . import skipdoctest #----------------------------------------------------------------------------- -# Globals -#----------------------------------------------------------------------------- - -# Make a bunch of nose.tools assert wrappers that can be used in test -# generators. This will expose an assert* function for each one in nose.tools. - -_tpl = """ -def %(name)s(*a,**kw): - return nt.%(name)s(*a,**kw) -""" - -if has_nose: - for _x in [a for a in dir(nt) if a.startswith('assert')]: - exec _tpl % dict(name=_x) - -#----------------------------------------------------------------------------- # Functions and classes #-----------------------------------------------------------------------------