Show More
@@ -243,3 +243,37 b' SystemExit Traceback (most recent call last)' | |||||
243 | <BLANKLINE> |
|
243 | <BLANKLINE> | |
244 | SystemExit: (2, 'Mode = exit') |
|
244 | SystemExit: (2, 'Mode = exit') | |
245 | """ |
|
245 | """ | |
|
246 | ||||
|
247 | ||||
|
248 | def test_runlines(): | |||
|
249 | import textwrap | |||
|
250 | ip.runlines(['a = 10', 'a+=1']) | |||
|
251 | ip.runlines('assert a == 11\nassert 1') | |||
|
252 | ||||
|
253 | nt.assert_equals(ip.user_ns['a'], 11) | |||
|
254 | complex = textwrap.dedent(""" | |||
|
255 | if 1: | |||
|
256 | print "hello" | |||
|
257 | if 1: | |||
|
258 | print "world" | |||
|
259 | ||||
|
260 | if 2: | |||
|
261 | print "foo" | |||
|
262 | ||||
|
263 | if 3: | |||
|
264 | print "bar" | |||
|
265 | ||||
|
266 | if 4: | |||
|
267 | print "bar" | |||
|
268 | ||||
|
269 | """) | |||
|
270 | # Simply verifies that this kind of input is run | |||
|
271 | ip.runlines(complex) | |||
|
272 | ||||
|
273 | ||||
|
274 | def test_db(): | |||
|
275 | """Test the internal database used for variable persistence.""" | |||
|
276 | ip.db['__unittest_'] = 12 | |||
|
277 | nt.assert_equals(ip.db['__unittest_'], 12) | |||
|
278 | del ip.db['__unittest_'] | |||
|
279 | assert '__unittest_' not in ip.db |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now