def test_convert_to_html_with_two_images(self): # test converting two images to HTML thumbnails path1 = relpath(join(test_dir, 'data', 'figures', 'figure1.svg')) path2 = relpath(join(test_dir, 'data', 'figures', 'figure2.svg')) counter = count(1) image = get_thumbnail_as_html(path1, next(counter)) image = get_thumbnail_as_html(path2, next(counter)) clean_image = "".join(image.strip().split()) clean_thumb = self.get_result(path2, 2) eq_(clean_image, clean_thumb)
def test_convert_to_html_thumbnail_not_found_error(self): # test FileNotFound error properly raised for thumbnail path1 = relpath(join(test_dir, 'data', 'figures', 'figure1.svg')) path2 = 'random/path/asftesfa/to/figure1.svg' image = get_thumbnail_as_html(path1, 1, path_to_thumbnail=path2)
def test_convert_to_html(self): # simple test of HTML thumbnail conversion path = relpath(join(test_dir, 'data', 'figures', 'figure1.svg')) image = get_thumbnail_as_html(path, 1) clean_image = "".join(image.strip().split()) clean_thumb = self.get_result(path) eq_(clean_image, clean_thumb)
def test_convert_to_html_with_png(self): # simple test of HTML thumbnail conversion # with a PNG file instead of SVG path = relpath(join(test_dir, 'data', 'figures', 'figure3.png')) image = get_thumbnail_as_html(path, 1) clean_image = "".join(image.strip().split()) clean_thumb = self.get_result(path) eq_(clean_image, clean_thumb)
def test_convert_to_html_with_different_thumbnail(self): # test converting image to HTML with different thumbnail path1 = relpath(join(test_dir, 'data', 'figures', 'figure1.svg')) path2 = relpath(join(test_dir, 'data', 'figures', 'figure2.svg')) image = get_thumbnail_as_html(path1, 1, path_to_thumbnail=path2) clean_image = "".join(image.strip().split()) clean_thumb = self.get_result(path1, other_path=path2) eq_(clean_image, clean_thumb)
def test_convert_to_html_with_absolute_path(self): # test converting image to HTML with absolute path path = relpath(join(test_dir, 'data', 'figures', 'figure1.svg')) path_absolute = abspath(path) image = get_thumbnail_as_html(path_absolute, 1) clean_image = "".join(image.strip().split()) clean_thumb = self.get_result(path) eq_(clean_image, clean_thumb)
def test_convert_to_html_file_not_found_error(self): # test FileNotFound error properly raised path = 'random/path/asftesfa/to/figure1.svg' get_thumbnail_as_html(path, 1)