##// END OF EJS Templates
Fix Image when passing only data, and add tests....
Matthias Bussonnier -
Show More
@@ -12,7 +12,6 b' import os'
12 import struct
12 import struct
13 import warnings
13 import warnings
14
14
15 from IPython.core.formatters import _safe_get_formatter_method
16 from IPython.utils.py3compat import (string_types, cast_bytes_py2, cast_unicode,
15 from IPython.utils.py3compat import (string_types, cast_bytes_py2, cast_unicode,
17 unicode_type)
16 unicode_type)
18 from IPython.testing.skipdoctest import skip_doctest
17 from IPython.testing.skipdoctest import skip_doctest
@@ -731,14 +730,14 b' class Image(DisplayObject):'
731 if data[:2] == _JPEG:
730 if data[:2] == _JPEG:
732 format = self._FMT_JPEG
731 format = self._FMT_JPEG
733
732
734 if format.lower() == 'jpg':
735 # jpg->jpeg
736 format = self._FMT_JPEG
737
738 # failed to detect format, default png
733 # failed to detect format, default png
739 if format is None:
734 if format is None:
740 format = 'png'
735 format = 'png'
741
736
737 if format.lower() == 'jpg':
738 # jpg->jpeg
739 format = self._FMT_JPEG
740
742 self.format = unicode_type(format).lower()
741 self.format = unicode_type(format).lower()
743 self.embed = embed if embed is not None else (url is None)
742 self.embed = embed if embed is not None else (url is None)
744
743
@@ -43,6 +43,9 b' def test_retina_jpeg():'
43 nt.assert_equal(md['width'], 1)
43 nt.assert_equal(md['width'], 1)
44 nt.assert_equal(md['height'], 1)
44 nt.assert_equal(md['height'], 1)
45
45
46 def test_base64image():
47 display.Image("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB94BCRQnOqNu0b4AAAAKSURBVAjXY2AAAAACAAHiIbwzAAAAAElFTkSuQmCC")
48
46 def test_image_filename_defaults():
49 def test_image_filename_defaults():
47 '''test format constraint, and validity of jpeg and png'''
50 '''test format constraint, and validity of jpeg and png'''
48 tpath = ipath.get_ipython_package_dir()
51 tpath = ipath.get_ipython_package_dir()
General Comments 0
You need to be logged in to leave comments. Login now