MCPcopy Index your code
hub / github.com/ipython/ipython / test_display_id

Function test_display_id

tests/test_display_2.py:443–478  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

441
442
443def test_display_id():
444 ip = get_ipython()
445 with mock.patch.object(ip.display_pub, "publish") as pub:
446 handle = display.display("x")
447 assert handle is None
448 handle = display.display("y", display_id="secret")
449 assert isinstance(handle, display.DisplayHandle)
450 handle2 = display.display("z", display_id=True)
451 assert isinstance(handle2, display.DisplayHandle)
452 assert handle.display_id != handle2.display_id
453
454 assert pub.call_count == 3
455 args, kwargs = pub.call_args_list[0]
456 assert args == ()
457 assert kwargs == {
458 "data": {"text/plain": repr("x")},
459 "metadata": {},
460 }
461 args, kwargs = pub.call_args_list[1]
462 assert args == ()
463 assert kwargs == {
464 "data": {"text/plain": repr("y")},
465 "metadata": {},
466 "transient": {
467 "display_id": handle.display_id,
468 },
469 }
470 args, kwargs = pub.call_args_list[2]
471 assert args == ()
472 assert kwargs == {
473 "data": {"text/plain": repr("z")},
474 "metadata": {},
475 "transient": {
476 "display_id": handle2.display_id,
477 },
478 }
479
480
481def test_update_display():

Callers

nothing calls this directly

Calls 2

get_ipythonFunction · 0.90
displayMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…