Show More
@@ -18,6 +18,8 b' __docformat__ = "restructuredtext en"' | |||||
18 | from IPython import genutils |
|
18 | from IPython import genutils | |
19 | from IPython.testing.decorators import skipif |
|
19 | from IPython.testing.decorators import skipif | |
20 | from nose import with_setup |
|
20 | from nose import with_setup | |
|
21 | from nose.tools import raises | |||
|
22 | ||||
21 | import os, sys, IPython |
|
23 | import os, sys, IPython | |
22 | env = os.environ |
|
24 | env = os.environ | |
23 |
|
25 | |||
@@ -200,3 +202,36 b' def test_get_ipython_dir_4():' | |||||
200 | def test_get_security_dir(): |
|
202 | def test_get_security_dir(): | |
201 | """Testcase to see if we can call get_security_dir without Exceptions.""" |
|
203 | """Testcase to see if we can call get_security_dir without Exceptions.""" | |
202 | sdir = genutils.get_security_dir() |
|
204 | sdir = genutils.get_security_dir() | |
|
205 | ||||
|
206 | ||||
|
207 | ||||
|
208 | ||||
|
209 | ||||
|
210 | def test_popkey_1(): | |||
|
211 | dct=dict(a=1, b=2, c=3) | |||
|
212 | assert genutils.popkey(dct, "a")==1 | |||
|
213 | assert dct==dict(b=2, c=3) | |||
|
214 | assert genutils.popkey(dct, "b")==2 | |||
|
215 | assert dct==dict(c=3) | |||
|
216 | assert genutils.popkey(dct, "c")==3 | |||
|
217 | assert dct==dict() | |||
|
218 | ||||
|
219 | @raises(KeyError) | |||
|
220 | def test_popkey_2(): | |||
|
221 | dct=dict(a=1, b=2, c=3) | |||
|
222 | genutils.popkey(dct, "d") | |||
|
223 | ||||
|
224 | def test_popkey_3(): | |||
|
225 | dct=dict(a=1, b=2, c=3) | |||
|
226 | assert genutils.popkey(dct, "A", 13)==13 | |||
|
227 | assert dct==dict(a=1, b=2, c=3) | |||
|
228 | assert genutils.popkey(dct, "B", 14)==14 | |||
|
229 | assert dct==dict(a=1, b=2, c=3) | |||
|
230 | assert genutils.popkey(dct, "C", 15)==15 | |||
|
231 | assert dct==dict(a=1, b=2, c=3) | |||
|
232 | assert genutils.popkey(dct, "a")==1 | |||
|
233 | assert dct==dict(b=2, c=3) | |||
|
234 | assert genutils.popkey(dct, "b")==2 | |||
|
235 | assert dct==dict(c=3) | |||
|
236 | assert genutils.popkey(dct, "c")==3 | |||
|
237 | assert dct==dict() |
General Comments 0
You need to be logged in to leave comments.
Login now