Show More
@@ -361,7 +361,21 b' def test_user_variables():' | |||
|
361 | 361 | |
|
362 | 362 | msg_id, reply = execute(code='x=1', user_variables=['x']) |
|
363 | 363 | user_variables = reply['user_variables'] |
|
364 |
nt.assert_equal(user_variables, {u'x' |
|
|
364 | nt.assert_equal(user_variables, {u'x': { | |
|
365 | u'status': u'ok', | |
|
366 | u'data': {u'text/plain': u'1'}, | |
|
367 | u'metadata': {}, | |
|
368 | }}) | |
|
369 | ||
|
370 | ||
|
371 | def test_user_variables_fail(): | |
|
372 | flush_channels() | |
|
373 | ||
|
374 | msg_id, reply = execute(code='x=1', user_variables=['nosuchname']) | |
|
375 | user_variables = reply['user_variables'] | |
|
376 | foo = user_variables['nosuchname'] | |
|
377 | nt.assert_equal(foo['status'], 'error') | |
|
378 | nt.assert_equal(foo['ename'], 'KeyError') | |
|
365 | 379 | |
|
366 | 380 | |
|
367 | 381 | def test_user_expressions(): |
@@ -369,7 +383,21 b' def test_user_expressions():' | |||
|
369 | 383 | |
|
370 | 384 | msg_id, reply = execute(code='x=1', user_expressions=dict(foo='x+1')) |
|
371 | 385 | user_expressions = reply['user_expressions'] |
|
372 |
nt.assert_equal(user_expressions, {u'foo' |
|
|
386 | nt.assert_equal(user_expressions, {u'foo': { | |
|
387 | u'status': u'ok', | |
|
388 | u'data': {u'text/plain': u'2'}, | |
|
389 | u'metadata': {}, | |
|
390 | }}) | |
|
391 | ||
|
392 | ||
|
393 | def test_user_expressions_fail(): | |
|
394 | flush_channels() | |
|
395 | ||
|
396 | msg_id, reply = execute(code='x=0', user_expressions=dict(foo='nosuchname')) | |
|
397 | user_expressions = reply['user_expressions'] | |
|
398 | foo = user_expressions['foo'] | |
|
399 | nt.assert_equal(foo['status'], 'error') | |
|
400 | nt.assert_equal(foo['ename'], 'NameError') | |
|
373 | 401 | |
|
374 | 402 | |
|
375 | 403 | @dec.parametric |
General Comments 0
You need to be logged in to leave comments.
Login now