()
| 358 | |
| 359 | |
| 360 | def test_json(): |
| 361 | d = {"a": 5} |
| 362 | lis = [d] |
| 363 | metadata = [ |
| 364 | {"expanded": False, "root": "root"}, |
| 365 | {"expanded": True, "root": "root"}, |
| 366 | {"expanded": False, "root": "custom"}, |
| 367 | {"expanded": True, "root": "custom"}, |
| 368 | ] |
| 369 | json_objs = [ |
| 370 | display.JSON(d), |
| 371 | display.JSON(d, expanded=True), |
| 372 | display.JSON(d, root="custom"), |
| 373 | display.JSON(d, expanded=True, root="custom"), |
| 374 | ] |
| 375 | for j, md in zip(json_objs, metadata): |
| 376 | assert j._repr_json_() == (d, md) |
| 377 | |
| 378 | with warnings.catch_warnings(record=True) as w: |
| 379 | warnings.simplefilter("always") |
| 380 | j = display.JSON(json.dumps(d)) |
| 381 | assert len(w) == 1 |
| 382 | assert j._repr_json_() == (d, metadata[0]) |
| 383 | |
| 384 | json_objs = [ |
| 385 | display.JSON(lis), |
| 386 | display.JSON(lis, expanded=True), |
| 387 | display.JSON(lis, root="custom"), |
| 388 | display.JSON(lis, expanded=True, root="custom"), |
| 389 | ] |
| 390 | for j, md in zip(json_objs, metadata): |
| 391 | assert j._repr_json_() == (lis, md) |
| 392 | |
| 393 | with warnings.catch_warnings(record=True) as w: |
| 394 | warnings.simplefilter("always") |
| 395 | j = display.JSON(json.dumps(lis)) |
| 396 | assert len(w) == 1 |
| 397 | assert j._repr_json_() == (lis, metadata[0]) |
| 398 | |
| 399 | |
| 400 | def test_video_embedding(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…