Skip to content

Instantly share code, notes, and snippets.

@stuaxo
Created October 3, 2018 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuaxo/ef022dcb73c12077b14171d1bc1b5589 to your computer and use it in GitHub Desktop.
Save stuaxo/ef022dcb73c12077b14171d1bc1b5589 to your computer and use it in GitHub Desktop.
Demonstrate inline png image
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@stuaxo
Copy link
Author

stuaxo commented Oct 4, 2018

===================================== test session starts =====================================
platform linux -- Python 3.6.5, pytest-3.8.2, py-1.6.0, pluggy-0.7.1
rootdir: /home/stu/projects/mine/scratch/notebooks, inifile:
plugins: nbval-0.9.1
collected 1 item                                                                              

Notebook with PNG.ipynb F                                                               [100%]

========================================== FAILURES ===========================================
_______________________________ Notebook with PNG.ipynb::Cell 0 _______________________________
Notebook cell execution failed
Cell 0: Cell outputs differ

Input:
import io

from IPython.display import display
from PIL import Image


path="Raspi_Colour_R.png"
        
with open(path, 'rb') as f:
    inline_image = Image.open(io.BytesIO(f.read()))
    display(inline_image)

Traceback:
 mismatch 'text/plain'

 assert reference_output == test_output failed:

  '<PIL.PngImag...7FFB2C071EF0>' == '<PIL.PngImage...7FAE093AF860>'
  Skipping 61 identical leading characters in diff, use -v to show
  - 67 at 0x7FFB2C071EF0>
  + 67 at 0x7FAE093AF860>


====================================== warnings summary =======================================
/home/stu/.virtualenvs/scratch/local/lib/python3.6/site-packages/jupyter_client/manager.py:62: DeprecationWarning: KernelManager._kernel_spec_manager_changed is deprecated in traitlets 4.1: use @observe and @unobserve instead.
  def _kernel_spec_manager_changed(self):

-- Docs: https://docs.pytest.org/en/latest/warnings.html
============================ 1 failed, 1 warnings in 2.12 seconds ============================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment