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

Function test_display_id

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

Source from the content-addressed store, hash-verified

343 nt.assert_equal(h._repr_html_(), (s, {"isolated": True}))
344
345def test_display_id():
346 ip = get_ipython()
347 with mock.patch.object(ip.display_pub, 'publish') as pub:
348 handle = display.display('x')
349 nt.assert_is(handle, None)
350 handle = display.display('y', display_id='secret')
351 nt.assert_is_instance(handle, display.DisplayHandle)
352 handle2 = display.display('z', display_id=True)
353 nt.assert_is_instance(handle2, display.DisplayHandle)
354 nt.assert_not_equal(handle.display_id, handle2.display_id)
355
356 nt.assert_equal(pub.call_count, 3)
357 args, kwargs = pub.call_args_list[0]
358 nt.assert_equal(args, ())
359 nt.assert_equal(kwargs, {
360 'data': {
361 'text/plain': repr('x')
362 },
363 'metadata': {},
364 })
365 args, kwargs = pub.call_args_list[1]
366 nt.assert_equal(args, ())
367 nt.assert_equal(kwargs, {
368 'data': {
369 'text/plain': repr('y')
370 },
371 'metadata': {},
372 'transient': {
373 'display_id': handle.display_id,
374 },
375 })
376 args, kwargs = pub.call_args_list[2]
377 nt.assert_equal(args, ())
378 nt.assert_equal(kwargs, {
379 'data': {
380 'text/plain': repr('z')
381 },
382 'metadata': {},
383 'transient': {
384 'display_id': handle2.display_id,
385 },
386 })
387
388
389def test_update_display():

Callers

nothing calls this directly

Calls 2

get_ipythonFunction · 0.90
displayMethod · 0.45

Tested by

no test coverage detected