Show More
@@ -484,7 +484,7 b' def test_extension():' | |||||
484 | _ip.user_ns.pop('arq', None) |
|
484 | _ip.user_ns.pop('arq', None) | |
485 | invalidate_caches() # Clear import caches |
|
485 | invalidate_caches() # Clear import caches | |
486 | _ip.magic("load_ext daft_extension") |
|
486 | _ip.magic("load_ext daft_extension") | |
487 |
|
|
487 | nt.assert_equal(_ip.user_ns['arq'], 185) | |
488 | _ip.magic("unload_ext daft_extension") |
|
488 | _ip.magic("unload_ext daft_extension") | |
489 | assert 'arq' not in _ip.user_ns |
|
489 | assert 'arq' not in _ip.user_ns | |
490 | finally: |
|
490 | finally: |
@@ -132,7 +132,7 b' class TestMagicRunPass(tt.TempFileMixin):' | |||||
132 | bid1 = id(_ip.user_ns['__builtins__']) |
|
132 | bid1 = id(_ip.user_ns['__builtins__']) | |
133 | self.run_tmpfile() |
|
133 | self.run_tmpfile() | |
134 | bid2 = id(_ip.user_ns['__builtins__']) |
|
134 | bid2 = id(_ip.user_ns['__builtins__']) | |
135 |
|
|
135 | nt.assert_equal(bid1, bid2) | |
136 |
|
136 | |||
137 | def test_builtins_type(self): |
|
137 | def test_builtins_type(self): | |
138 | """Check that the type of __builtins__ doesn't change with %run. |
|
138 | """Check that the type of __builtins__ doesn't change with %run. | |
@@ -143,7 +143,7 b' class TestMagicRunPass(tt.TempFileMixin):' | |||||
143 | """ |
|
143 | """ | |
144 | _ip = get_ipython() |
|
144 | _ip = get_ipython() | |
145 | self.run_tmpfile() |
|
145 | self.run_tmpfile() | |
146 |
|
|
146 | nt.assert_equal(type(_ip.user_ns['__builtins__']),type(sys)) | |
147 |
|
147 | |||
148 | def test_prompts(self): |
|
148 | def test_prompts(self): | |
149 | """Test that prompts correctly generate after %run""" |
|
149 | """Test that prompts correctly generate after %run""" | |
@@ -206,7 +206,7 b' class TestMagicRunSimple(tt.TempFileMixin):' | |||||
206 | self.mktmp(py3compat.doctest_refactor_print(src)) |
|
206 | self.mktmp(py3compat.doctest_refactor_print(src)) | |
207 | _ip.magic('run %s' % self.fname) |
|
207 | _ip.magic('run %s' % self.fname) | |
208 | _ip.run_cell('ip == get_ipython()') |
|
208 | _ip.run_cell('ip == get_ipython()') | |
209 |
|
|
209 | nt.assert_equal(_ip.user_ns['i'], 5) | |
210 |
|
210 | |||
211 | @dec.skip_win32 |
|
211 | @dec.skip_win32 | |
212 | def test_tclass(self): |
|
212 | def test_tclass(self): | |
@@ -236,15 +236,15 b' tclass.py: deleting object: C-third' | |||||
236 | self.mktmp(src) |
|
236 | self.mktmp(src) | |
237 | _ip.run_cell("zz = 23") |
|
237 | _ip.run_cell("zz = 23") | |
238 | _ip.magic('run -i %s' % self.fname) |
|
238 | _ip.magic('run -i %s' % self.fname) | |
239 |
|
|
239 | nt.assert_equal(_ip.user_ns['yy'], 23) | |
240 | _ip.magic('reset -f') |
|
240 | _ip.magic('reset -f') | |
241 | _ip.run_cell("zz = 23") |
|
241 | _ip.run_cell("zz = 23") | |
242 | _ip.magic('run -i %s' % self.fname) |
|
242 | _ip.magic('run -i %s' % self.fname) | |
243 |
|
|
243 | nt.assert_equal(_ip.user_ns['yy'], 23) | |
244 |
|
244 | |||
245 | def test_unicode(self): |
|
245 | def test_unicode(self): | |
246 | """Check that files in odd encodings are accepted.""" |
|
246 | """Check that files in odd encodings are accepted.""" | |
247 | mydir = os.path.dirname(__file__) |
|
247 | mydir = os.path.dirname(__file__) | |
248 | na = os.path.join(mydir, 'nonascii.py') |
|
248 | na = os.path.join(mydir, 'nonascii.py') | |
249 | _ip.magic('run "%s"' % na) |
|
249 | _ip.magic('run "%s"' % na) | |
250 |
|
|
250 | nt.assert_equal(_ip.user_ns['u'], u'Ўт№Ф') |
@@ -1,10 +1,5 b'' | |||||
1 | """Generic testing tools. |
|
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 | Authors |
|
3 | Authors | |
9 | ------- |
|
4 | ------- | |
10 | - Fernando Perez <Fernando.Perez@berkeley.edu> |
|
5 | - Fernando Perez <Fernando.Perez@berkeley.edu> | |
@@ -51,22 +46,6 b' from . import decorators as dec' | |||||
51 | from . import skipdoctest |
|
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 | # Functions and classes |
|
49 | # Functions and classes | |
71 | #----------------------------------------------------------------------------- |
|
50 | #----------------------------------------------------------------------------- | |
72 |
|
51 |
General Comments 0
You need to be logged in to leave comments.
Login now