MCPcopy Create free account
hub / github.com/ipython/ipython / test_display_handle

Function test_display_handle

IPython/core/tests/test_display.py:422–454  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

420
421
422def test_display_handle():
423 ip = get_ipython()
424 handle = display.DisplayHandle()
425 nt.assert_is_instance(handle.display_id, str)
426 handle = display.DisplayHandle('my-id')
427 nt.assert_equal(handle.display_id, 'my-id')
428 with mock.patch.object(ip.display_pub, 'publish') as pub:
429 handle.display('x')
430 handle.update('y')
431
432 args, kwargs = pub.call_args_list[0]
433 nt.assert_equal(args, ())
434 nt.assert_equal(kwargs, {
435 'data': {
436 'text/plain': repr('x')
437 },
438 'metadata': {},
439 'transient': {
440 'display_id': handle.display_id,
441 }
442 })
443 args, kwargs = pub.call_args_list[1]
444 nt.assert_equal(args, ())
445 nt.assert_equal(kwargs, {
446 'data': {
447 'text/plain': repr('y')
448 },
449 'metadata': {},
450 'transient': {
451 'display_id': handle.display_id,
452 },
453 'update': True,
454 })
455

Callers

nothing calls this directly

Calls 3

displayMethod · 0.95
updateMethod · 0.95
get_ipythonFunction · 0.90

Tested by

no test coverage detected